diff --git a/packages/core/src/components/persea/index.jsx b/packages/core/src/components/persea/index.jsx index e4a1a38..c0d0bc8 100644 --- a/packages/core/src/components/persea/index.jsx +++ b/packages/core/src/components/persea/index.jsx @@ -2,36 +2,23 @@ import { React, hot, } from '@flecks/react'; -// import { -// Navigate, -// Route, -// Routes, -// } from '@flecks/react/router'; -// import {useSelector} from '@flecks/redux'; -// import {userIdSelector} from '@flecks/user'; import './global.scss'; import styles from './index.module.scss'; -// import Dashboard from '../dashboard'; -import Login from './login'; -// import ProjectRoute from '../project/route'; +import useLocalStorage from '../../hooks/use-local-storage'; +import Resource from './resource'; +import Sidebar from './sidebar'; -// eslint-disable-next-line arrow-body-style -const Persea = () => { - // const isLoggedIn = useSelector(userIdSelector); +function Persea() { + const [expanded, setExpanded] = useLocalStorage('@persea/core/expanded', true); return (
- - {/* - } /> - : } /> - } /> - } /> - */} + +
); -}; +} Persea.displayName = 'Persea'; diff --git a/packages/core/src/components/persea/index.module.scss b/packages/core/src/components/persea/index.module.scss index b1586c3..0384176 100644 --- a/packages/core/src/components/persea/index.module.scss +++ b/packages/core/src/components/persea/index.module.scss @@ -1,5 +1,5 @@ - .persea { + display: flex; height: 100vh; width: 100vw; } diff --git a/packages/core/src/components/persea/resource/index.jsx b/packages/core/src/components/persea/resource/index.jsx new file mode 100644 index 0000000..589baf4 --- /dev/null +++ b/packages/core/src/components/persea/resource/index.jsx @@ -0,0 +1,36 @@ +import {classnames, PropTypes, React} from '@flecks/react'; +import {useSelector} from '@flecks/redux'; + +import styles from './index.module.scss'; + +import {projectsSelector} from '../../../state/projects'; +import Login from './login'; + +function Resource({expanded}) { + const {structure} = useSelector(projectsSelector); + const projects = Object.entries(structure); + return ( +
+ { + projects.length > 0 + ?

{projects.length}

+ : ( +
+

You must log in to access your projects.

+ +
+ ) + } +
+ ); +} + +Resource.defaultProps = {}; + +Resource.displayName = 'Resource'; + +Resource.propTypes = { + expanded: PropTypes.bool.isRequired, +}; + +export default Resource; diff --git a/packages/core/src/components/persea/resource/index.module.scss b/packages/core/src/components/persea/resource/index.module.scss new file mode 100644 index 0000000..efbb350 --- /dev/null +++ b/packages/core/src/components/persea/resource/index.module.scss @@ -0,0 +1,16 @@ +.resource { + background-color: #1a1a1a; + height: 100%; + width: calc(100% - 3rem); + + &.expanded { + width: calc(100% - 25rem); + } + + .login { + p { + margin: 3em; + text-align: center; + } + } +} diff --git a/packages/core/src/components/persea/login/index.jsx b/packages/core/src/components/persea/resource/login/index.jsx similarity index 78% rename from packages/core/src/components/persea/login/index.jsx rename to packages/core/src/components/persea/resource/login/index.jsx index 6c0872c..49030c0 100644 --- a/packages/core/src/components/persea/login/index.jsx +++ b/packages/core/src/components/persea/resource/login/index.jsx @@ -6,10 +6,6 @@ import styles from './index.module.scss'; function Login() { return (
-
-

Sign in

-

You must sign in to continue

-
); diff --git a/packages/core/src/components/persea/login/index.module.scss b/packages/core/src/components/persea/resource/login/index.module.scss similarity index 82% rename from packages/core/src/components/persea/login/index.module.scss rename to packages/core/src/components/persea/resource/login/index.module.scss index 6c34019..f3ca7ff 100644 --- a/packages/core/src/components/persea/login/index.module.scss +++ b/packages/core/src/components/persea/resource/login/index.module.scss @@ -1,16 +1,6 @@ .login { margin: auto; max-width: 60%; - padding-top: 5%; - - > div { - text-align: center; - padding-bottom: 2em; - - h2 { - padding-bottom: 1em; - } - } form { background-color: #272727; @@ -38,6 +28,7 @@ div { align-items: center; display: flex; + flex-wrap: wrap; justify-content: space-between; [type="checkbox"] { @@ -48,8 +39,9 @@ } label { - display: block; + display: inline-block; flex-direction: row; + width: auto; input, span { margin: 0; @@ -57,7 +49,7 @@ } a { - padding: 1em 1em 1em 0; + padding: 1em; text-decoration: none; white-space: nowrap; } diff --git a/packages/core/src/components/persea/sidebar/content/index.jsx b/packages/core/src/components/persea/sidebar/content/index.jsx new file mode 100644 index 0000000..a3aab29 --- /dev/null +++ b/packages/core/src/components/persea/sidebar/content/index.jsx @@ -0,0 +1,27 @@ +import {PropTypes, React} from '@flecks/react'; + +import styles from './index.module.scss'; + +function Content({Content, name}) { + return ( +
+ {Content && ( + <> +

{name}

+ {Content} + + )} +
+ ); +} + +Content.defaultProps = {}; + +Content.displayName = 'Content'; + +Content.propTypes = { + Content: PropTypes.node.isRequired, + name: PropTypes.string.isRequired, +}; + +export default Content; diff --git a/packages/core/src/components/persea/sidebar/content/index.module.scss b/packages/core/src/components/persea/sidebar/content/index.module.scss new file mode 100644 index 0000000..f75a84b --- /dev/null +++ b/packages/core/src/components/persea/sidebar/content/index.module.scss @@ -0,0 +1,14 @@ +.content { + background-color: #272727; + height: 100%; + overflow: auto; + width: calc(100% - 3rem); +} + +.name { + color: #ccc; + font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif; + font-size: 0.8em; + padding: 1em; + text-transform: uppercase; +} diff --git a/packages/core/src/components/persea/sidebar/icon/index.jsx b/packages/core/src/components/persea/sidebar/icon/index.jsx new file mode 100644 index 0000000..811f8b1 --- /dev/null +++ b/packages/core/src/components/persea/sidebar/icon/index.jsx @@ -0,0 +1,41 @@ +import {classnames, PropTypes, React} from '@flecks/react'; + +import styles from './index.module.scss'; + +function Icon({ + className, + isActive, + name, + onClick, +}) { + return ( +