From 4231a16169ac0174b92cfa63768e9afd6913e0d5 Mon Sep 17 00:00:00 2001 From: Eran Machiels Date: Tue, 10 Nov 2020 20:14:42 +0100 Subject: [PATCH 1/5] WIP --- src/components/Navigation/Navigation.tsx | 41 + .../Navigation/Vertical/Divider.tsx | 17 + src/components/Navigation/Vertical/List.tsx | 31 + .../Navigation/Vertical/ListItem.tsx | 44 + src/components/Navigation/Vertical/Top.tsx | 31 + .../Navigation/VerticalNavigation.tsx | 57 + src/components/Navigation/index.ts | 1 + src/components/Page/Main.tsx | 31 + src/components/Page/Page.tsx | 8 +- src/components/Page/PageContext.ts | 7 + src/components/Page/Side.tsx | 54 + src/components/Panel/Panel.tsx | 21 +- src/images/coderan/logo.svg | 87 + src/style/base/_variables.scss | 21 + src/style/components/_logos.scss | 10 + src/style/components/_navigation.scss | 63 + src/style/components/_page.scss | 36 +- src/style/components/_panel.scss | 6 +- src/style/index.scss | 2 + www/src/index.tsx | 3232 +++++++++-------- 20 files changed, 2182 insertions(+), 1618 deletions(-) create mode 100644 src/components/Navigation/Navigation.tsx create mode 100644 src/components/Navigation/Vertical/Divider.tsx create mode 100644 src/components/Navigation/Vertical/List.tsx create mode 100644 src/components/Navigation/Vertical/ListItem.tsx create mode 100644 src/components/Navigation/Vertical/Top.tsx create mode 100644 src/components/Navigation/VerticalNavigation.tsx create mode 100644 src/components/Navigation/index.ts create mode 100644 src/components/Page/Main.tsx create mode 100644 src/components/Page/PageContext.ts create mode 100644 src/components/Page/Side.tsx create mode 100644 src/images/coderan/logo.svg create mode 100644 src/style/components/_logos.scss create mode 100644 src/style/components/_navigation.scss diff --git a/src/components/Navigation/Navigation.tsx b/src/components/Navigation/Navigation.tsx new file mode 100644 index 0000000..2809261 --- /dev/null +++ b/src/components/Navigation/Navigation.tsx @@ -0,0 +1,41 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import { Panel } from '@/components'; +import clsx from 'clsx'; + +interface NavigationProps extends React.HTMLAttributes { + sticky?: boolean; +} + +const Navigation = React.forwardRef(( + { + children, + className, + sticky + }, + ref +): React.ReactElement => ( + + + +)); + +Navigation.displayName = 'PageNavigation'; +Navigation.propTypes = { + children: PropTypes.node, + className: PropTypes.string, + sticky: PropTypes.bool +} + +export default Navigation; diff --git a/src/components/Navigation/Vertical/Divider.tsx b/src/components/Navigation/Vertical/Divider.tsx new file mode 100644 index 0000000..e24d4ad --- /dev/null +++ b/src/components/Navigation/Vertical/Divider.tsx @@ -0,0 +1,17 @@ +import * as React from 'react'; + +type NavigationDividerProps = React.HTMLAttributes; + +const NavigationDivider = React.forwardRef(( + _, + ref +): React.ReactElement => ( +
+)); + +NavigationDivider.displayName = 'NavigationDivider'; + +export default NavigationDivider; diff --git a/src/components/Navigation/Vertical/List.tsx b/src/components/Navigation/Vertical/List.tsx new file mode 100644 index 0000000..01ed89c --- /dev/null +++ b/src/components/Navigation/Vertical/List.tsx @@ -0,0 +1,31 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import clsx from 'clsx'; + +type NavigationListProps = React.HTMLAttributes; + +const NavigationList = React.forwardRef(( + { + children, + className + }, + ref +): React.ReactElement => ( + +)); + +NavigationList.displayName = 'NavigationList'; +NavigationList.propTypes = { + children: PropTypes.node, + className: PropTypes.string +}; + +export default NavigationList; diff --git a/src/components/Navigation/Vertical/ListItem.tsx b/src/components/Navigation/Vertical/ListItem.tsx new file mode 100644 index 0000000..d40b592 --- /dev/null +++ b/src/components/Navigation/Vertical/ListItem.tsx @@ -0,0 +1,44 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import clsx from 'clsx'; + +interface NavigationListItemProps extends React.HTMLAttributes { + active?: boolean; + icon?: React.ReactElement; +} + +const NavigationListItem = React.forwardRef(( + { + active, + children, + className, + icon + }, + ref +): React.ReactElement => ( +
+ {icon && ( +
+ {icon} +
+ )} + {children} +
+)); + +NavigationListItem.displayName = 'NavigationListItem'; +NavigationListItem.propTypes = { + active: PropTypes.bool, + children: PropTypes.node, + className: PropTypes.string, + icon: PropTypes.element +}; + +export default NavigationListItem; diff --git a/src/components/Navigation/Vertical/Top.tsx b/src/components/Navigation/Vertical/Top.tsx new file mode 100644 index 0000000..df547c1 --- /dev/null +++ b/src/components/Navigation/Vertical/Top.tsx @@ -0,0 +1,31 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import clsx from 'clsx'; + +type NavigationTopProps = React.HTMLAttributes; + +const NavigationTop = React.forwardRef(( + { + children, + className + }, + ref +): React.ReactElement => ( +
+ {children} +
+)); + +NavigationTop.displayName = 'NavigationTop'; +NavigationTop.propTypes = { + children: PropTypes.node, + className: PropTypes.string +} + +export default NavigationTop; diff --git a/src/components/Navigation/VerticalNavigation.tsx b/src/components/Navigation/VerticalNavigation.tsx new file mode 100644 index 0000000..83afac7 --- /dev/null +++ b/src/components/Navigation/VerticalNavigation.tsx @@ -0,0 +1,57 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import clsx from 'clsx'; +import { ForwardComponentWithStatics } from '@/components/utils/ForwardComponentWithStatics'; +import { Variant } from '@/components'; +import NavigationTop from '@/components/Navigation/Vertical/Top'; +import NavigationList from '@/components/Navigation/Vertical/List'; +import NavigationListItem from '@/components/Navigation/Vertical/ListItem'; +import NavigationDivider from '@/components/Navigation/Vertical/Divider'; + +export interface VerticalNavigationStatics { + Top: typeof NavigationTop; + List: typeof NavigationList; + Item: typeof NavigationListItem; + Divider: typeof NavigationDivider; +} + +export interface SideNavigationProps extends React.HTMLAttributes { + variant?: Variant | string; +} + +// @ts-ignore +const VerticalNavigation: ForwardComponentWithStatics = + React.forwardRef(( + { + children, + className, + variant + }, + ref + ): React.ReactElement => ( +
+ {children} +
+ )); + +VerticalNavigation.displayName = 'VerticalNavigation'; +VerticalNavigation.propTypes = { + children: PropTypes.node, + className: PropTypes.string, + variant: PropTypes.string +} + +VerticalNavigation.Top = NavigationTop; +VerticalNavigation.List = NavigationList; +VerticalNavigation.Item = NavigationListItem; +VerticalNavigation.Divider = NavigationDivider; + + +export default VerticalNavigation; diff --git a/src/components/Navigation/index.ts b/src/components/Navigation/index.ts new file mode 100644 index 0000000..76443bd --- /dev/null +++ b/src/components/Navigation/index.ts @@ -0,0 +1 @@ +export { default as Navigation } from './Navigation'; diff --git a/src/components/Page/Main.tsx b/src/components/Page/Main.tsx new file mode 100644 index 0000000..ddb57d4 --- /dev/null +++ b/src/components/Page/Main.tsx @@ -0,0 +1,31 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import clsx from 'clsx'; + +type PageMainProps = React.HTMLAttributes; + +const PageMain = React.forwardRef(( + { + children, + className + }, + ref +): React.ReactElement => ( +
+ {children} +
+)); + +PageMain.displayName = 'PageMain'; +PageMain.propTypes = { + children: PropTypes.node, + className: PropTypes.string +} + +export default PageMain; diff --git a/src/components/Page/Page.tsx b/src/components/Page/Page.tsx index 48344b2..36936e8 100644 --- a/src/components/Page/Page.tsx +++ b/src/components/Page/Page.tsx @@ -2,8 +2,12 @@ import * as React from 'react'; import clsx from 'clsx'; import PageHeader from '@/components/Page/Header'; import PageContent from '@/components/Page/Content'; +import PageMain from '@/components/Page/Main'; +import Side from '@/components/Page/Side'; -export type PageProps = React.HTMLAttributes ; +export interface PageProps extends React.HTMLAttributes { + sticky?: boolean; +} const Page = ({ children, @@ -21,5 +25,7 @@ const Page = ({ Page.Header = PageHeader; Page.Content = PageContent; +Page.Side = Side; +Page.Main = PageMain; export default Page; diff --git a/src/components/Page/PageContext.ts b/src/components/Page/PageContext.ts new file mode 100644 index 0000000..6a0245b --- /dev/null +++ b/src/components/Page/PageContext.ts @@ -0,0 +1,7 @@ +import { createContext } from 'react'; + +export interface PageContextProps { + +} + +export const PageContext = createContext({}) diff --git a/src/components/Page/Side.tsx b/src/components/Page/Side.tsx new file mode 100644 index 0000000..a289b71 --- /dev/null +++ b/src/components/Page/Side.tsx @@ -0,0 +1,54 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import clsx from 'clsx'; +import { Panel, Variant } from '@/components'; + +export enum Position { + LEFT = 'left', + RIGHT = 'right' +} + +export interface PageSideProps extends React.HTMLAttributes { + position?: Position | string; + spaced?: boolean; + fixed?: boolean; + variant?: Variant | string; +} + +const PageSide = React.forwardRef(( + { + children, + className, + position, + spaced, + fixed, + variant + }, + ref +): React.ReactElement => ( + + {children} + +)); + +PageSide.displayName = 'Side'; +PageSide.propTypes = { + children: PropTypes.node, + className: PropTypes.string, + position: PropTypes.string, + spaced: PropTypes.bool, + fixed: PropTypes.bool, + variant: PropTypes.string +} + +export default PageSide; diff --git a/src/components/Panel/Panel.tsx b/src/components/Panel/Panel.tsx index cf4c28a..a52cc41 100644 --- a/src/components/Panel/Panel.tsx +++ b/src/components/Panel/Panel.tsx @@ -1,24 +1,37 @@ import * as React from 'react'; import clsx from 'clsx'; +import PropTypes from 'prop-types'; +import { Variant } from '@/components'; interface PanelProps extends React.HTMLAttributes { spaced?: boolean; + variant?: Variant| string; } -const Panel = ({ +const Panel = React.forwardRef(({ children, className, - spaced -}: React.PropsWithChildren): React.ReactElement => ( + spaced, + variant +}): React.ReactElement => (
{children}
-); +)); + +Panel.displayName = 'Panel'; +Panel.propTypes = { + children: PropTypes.node, + className: PropTypes.string, + spaced: PropTypes.bool, + variant: PropTypes.string +} export default Panel; diff --git a/src/images/coderan/logo.svg b/src/images/coderan/logo.svg new file mode 100644 index 0000000..9a4efe7 --- /dev/null +++ b/src/images/coderan/logo.svg @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/style/base/_variables.scss b/src/style/base/_variables.scss index 41b28a7..bbc8b13 100644 --- a/src/style/base/_variables.scss +++ b/src/style/base/_variables.scss @@ -39,6 +39,7 @@ $primary-color: mixins.color('deepPurple', 600); $primary-color-hover: mixins.color('deepPurple', 700); $primary-color-active: mixins.color('deepPurple', 800); $primary-color-light-background: mixins.color('deepPurple', 50); +$primary-color-shadow-lighter: mixins.color('deepPurple', 400); $secondary-color: mixins.color('red', 600); $secondary-color-hover: mixins.color('red', 700); @@ -58,6 +59,7 @@ $success-color-active: mixins.color('green', 900); --primary-color-hover: #{$primary-color-hover}; --primary-color-active: #{$primary-color-active}; --primary-color-light-background: #{$primary-color-light-background}; + --primary-color-shadow-lighter: #{$primary-color-shadow-lighter}; --secondary-color: #{$secondary-color}; --secondary-color-hover: #{$secondary-color-hover}; @@ -88,9 +90,17 @@ $panel-gutter: 2rem; * 4. Page */ $page-gutter: 2rem; +$page-side-background-color: mixins.color('gray', 100); +$page-side-border-color: mixins.color('gray', 300); +$page-side-gutter: 1rem; +$page-header-height: 120px; :root { --page-gutter: #{$page-gutter}; + --page-side-background-color: #{$page-side-background-color}; + --page-side-border-color: #{$page-side-border-color}; + --page-side-gutter: #{$page-side-gutter}; + --page-header-height: #{$page-header-height} } /** @@ -435,3 +445,14 @@ $form-field-font-size: 1rem; --form-field-font-weight: #{$form-field-font-weight}; --form-field-font-size: #{$form-field-font-size}; } + +/** + * 9. Navigation + */ +$vertical-navigation-border-color: mixins.color('gray', 300); +$vertical-navigation-active-item-background-color: rgba(0, 0, 0, .05); + +:root { + --vertical-navigation-border-color: #{$vertical-navigation-border-color}; + --vertical-navigation-active-item-background-color: #{$vertical-navigation-active-item-background-color}; +} diff --git a/src/style/components/_logos.scss b/src/style/components/_logos.scss new file mode 100644 index 0000000..e75bbb4 --- /dev/null +++ b/src/style/components/_logos.scss @@ -0,0 +1,10 @@ +.coderan { + background: url("../images/coderan/logo.svg"); + width: 100px; +} + +.coderan-light { + background: url("../images/coderan/logo-white.svg"); + width: 240px; + height: auto; +} diff --git a/src/style/components/_navigation.scss b/src/style/components/_navigation.scss new file mode 100644 index 0000000..2b1e476 --- /dev/null +++ b/src/style/components/_navigation.scss @@ -0,0 +1,63 @@ +@use "../base/mixins"; + +.vertical-navigation-container { + width: 100%; + min-width: 240px; + display: flex; + flex-direction: column; + height: 100vh; + position: relative; + + .vertical-navigation-top { + min-height: var(--page-header-height); + padding: 0 var(--base-gutter); + display: flex; + align-items: center; + } + + .vertical-navigation-divider { + height: 1px; + background: var(--vertical-navigation-border-color); + width: 100%; + } + + .vertical-navigation-list { + padding: var(--base-gutter); + overflow-y: scroll; + + .vertical-navigation-list-item { + align-items: center; + cursor: pointer; + color: currentColor; + display: flex; + padding: var(--base-gutter); + border-radius: var(--base-border-radius); + font: { + weight: 500; + } + + &:hover { + background: var(--vertical-navigation-active-item-background-color); + } + + .vertical-navigation-list-item-icon { + margin-right: var(--base-gutter); + font: { + size: 1.1rem; + } + } + } + } +} + +.navigation-primary { + color: mixins.color('deepPurple', 50); + + .vertical-navigation-list-item { + color: currentColor; + } + + .vertical-navigation-divider { + background: var(--primary-color-shadow-lighter); + } +} diff --git a/src/style/components/_page.scss b/src/style/components/_page.scss index 7464431..1cefbcb 100644 --- a/src/style/components/_page.scss +++ b/src/style/components/_page.scss @@ -1,28 +1,50 @@ @use "../base/mixins"; .page { - background: var(--page-background-color); + display: flex; + + .page-main { + display: flex; + flex-direction: column; + flex: 1 1 100%; + } .page-header { border-bottom: solid 1px var(--base-border-color); - padding-top: var(--page-gutter); padding-right: var(--page-gutter); padding-left: var(--page-gutter); - - &:not(.with-title) { - padding-bottom: var(--page-gutter); - } + height: var(--page-header-height); + display: flex; + align-items: center; .page-header-title { font-size: 2rem; color: mixins.color('gray', 900); font-weight: normal; margin: 0; - padding-bottom: var(--page-gutter); } } .page-content { padding: var(--page-gutter); } + + .page-side { + flex: 1 1 auto; + background: var(--page-side-background-color); + + &.page-side-right { + border-left: solid 1px var(--page-side-border-color); + } + + &.page-side-left { + border-right: solid 1px var(--page-side-border-color); + } + + &.page-side-fixed { + align-self: flex-start; + position: sticky; + top: 0; /* required */ + } + } } diff --git a/src/style/components/_panel.scss b/src/style/components/_panel.scss index e46dc3a..ce1bd5f 100644 --- a/src/style/components/_panel.scss +++ b/src/style/components/_panel.scss @@ -2,6 +2,10 @@ background: var(--panel-background); &.panel-spaced { - padding: var(--panel-gutter); + padding: var(--base-gutter); + } + + &.panel-primary { + background: var(--primary-color); } } diff --git a/src/style/index.scss b/src/style/index.scss index abad4b0..b23232b 100644 --- a/src/style/index.scss +++ b/src/style/index.scss @@ -17,6 +17,8 @@ @use "components/card"; @use "components/icons"; @use "components/forms"; +@use "components/navigation"; +@use "components/logos"; /** * 3. Layout diff --git a/www/src/index.tsx b/www/src/index.tsx index 54da55d..83d3b27 100644 --- a/www/src/index.tsx +++ b/www/src/index.tsx @@ -1,13 +1,15 @@ import * as React from 'react'; +import { useState } from 'react'; import * as ReactDom from 'react-dom'; import '../../src/style/index.scss'; +import logo from '@/images/coderan/logo.svg'; import { Button, Card, Col, Grid, Icon, Page, Row, SelectField, TextField, Variant } from '../../src'; import Container from '../../src/components/Container/Container'; import FormGroup from '../../src/components/Form/Group'; import FormLabel from '../../src/components/Form/Label'; import FormMessage from '../../src/components/Form/Message'; -import { useState } from 'react'; +import VerticalNavigation from '../../src/components/Navigation/VerticalNavigation'; const TestControllable = () => { const [value, setValue] = useState(''); @@ -32,1618 +34,1638 @@ const TestControllable = () => { } ReactDom.render( - - - - - - - - - -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
- - - - - - - Col 1/1 - - - Col 1/2 - Col 2/2 - + <> + + + + + + + + + } - - Col 1/3 - Col 2/3 - Col 3/4 - + > + Home + + + + + + + + + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + + + + + + Col 1/1 + + + Col 1/2 + Col 2/2 + - - Col 1/3 - Col 2/3 - Col 3/4 - + + Col 1/3 + Col 2/3 + Col 3/4 + - - Col 1/4 - Col 2/4 - Col 3/4 - Col 4/4 - - - - - - - - - - -
Standard input
- Username - -
+ + Col 1/3 + Col 2/3 + Col 3/4 + - -
Input with floating label
- -
+ + Col 1/4 + Col 2/4 + Col 3/4 + Col 4/4 + +
+
+
+
+ + + + + +
Standard input
+ Username + +
- -
Input with default value
- -
+ +
Input with floating label
+ +
- -
Input with actions
- { + +
Input with default value
+ +
- }} - actions={[ - - ]} - valid={true} - /> -
+ +
Input with actions
+ { - -
Invalid input
- - - Input is invalid - -
+ }} + actions={[ + + ]} + valid={true} + /> +
- -
Valid input
- -
- -
Valid input
- - - - - - - -
- -
-
-
- - - - -
Activity
- -
-
- - -
Alert circle
- -
-
- - -
Alert triangle
- -
-
- - -
Archive
- -
-
- - -
Arrow left
- -
-
- - -
Arrow circle down
- -
-
- - -
Arrow circle left
- -
-
- - -
Arrow circle right
- -
-
- - -
Arrow circle up
- -
-
- - -
Sort down
- -
-
- - -
Sort down
- -
-
- - -
Arrow right
- -
-
- - -
Arrow alt left
- -
-
- - -
Arrow alt down
- -
-
- - -
Arrow alt right
- -
-
- - -
Arrow alt up
- -
-
- - -
Sort left
- -
-
- - -
Sort right
- -
-
- - -
Sort up
- -
-
- - -
Arrow up
- -
-
- - -
chevron-double down
- -
-
- - -
chevron-double left
- -
-
- - -
chevron-double right
- -
-
- - -
chevron-double up
- -
-
- - -
At
- -
-
- - -
Attach 2
- -
-
- - -
Attach
- -
-
- - -
Award
- -
-
- - -
Backspace
- -
-
- - -
Bar chart 2
- -
-
- - -
Bar chart
- -
-
- - -
Battery
- -
-
- - -
Behance
- -
-
- - -
Bell off
- -
-
- - -
Bell
- -
-
- - -
Bluetooth
- -
-
- - -
Book open
- -
-
- - -
Book
- -
-
- - -
Bookmark
- -
-
- - -
Briefcase
- -
-
- - -
Browser
- -
-
- - -
Brush
- -
-
- - -
Bulb
- -
-
- - -
Calendar
- -
-
- - -
Camera
- -
-
- - -
Car
- -
-
- - -
Cast
- -
-
- - -
Charging
- -
-
- - -
Checkmark circle 2
- -
-
- - -
Checkmark circle
- -
-
- - -
Checkmark
- -
-
- - -
Checkmark square 2
- -
-
- - -
Checkmark square
- -
-
- - -
Chevron down
- -
-
- - -
Chevron left
- -
-
- - -
Chevron right
- -
-
- - -
Chevron up
- -
-
- - -
Clipboard
- -
-
- - -
Clock
- -
-
- - -
Close circle
- -
-
- - -
Close
- -
-
- - -
Close square
- -
-
- - -
Cloud download
- -
-
- - -
Cloud upload
- -
-
- - -
Code download
- -
-
- - -
Code
- -
-
- - -
Collapse
- -
-
- - -
Color palette
- -
-
- - -
Color picker
- -
-
- - -
Compass
- -
-
- - -
Copy
- -
-
- - -
Corner down left
- -
-
- - -
Corner down right
- -
-
- - -
Corner left down
- -
-
- - -
Corner left up
- -
-
- - -
Corner right down
- -
-
- - -
Corner right up
- -
-
- - -
Corner up left
- -
-
- - -
Corner up right
- -
-
- - -
Credit card
- -
-
- - -
Crop
- -
-
- - -
Cube
- -
-
- - -
Diagonal arrow left down
- -
-
- - -
Diagonal arrow left up
- -
-
- - -
Diagonal arrow right down
- -
-
- - -
Diagonal arrow right up
- -
-
- - -
Done all
- -
-
- - -
Download
- -
-
- - -
Droplet off
- -
-
- - -
Droplet
- -
-
- - -
Edit 2
- -
-
- - -
Edit
- -
-
- - -
Email
- -
-
- - -
Expand
- -
-
- - -
External link
- -
-
- - -
Eye off 2
- -
-
- - -
Eye off
- -
-
- - -
Eye
- -
-
- - -
Facebook
- -
-
- - -
File add
- -
-
- - -
File
- -
-
- - -
File remove
- -
-
- - -
File text
- -
-
- - -
Film
- -
-
- - -
Flag
- -
-
- - -
Flash off
- -
-
- - -
Flash
- -
-
- - -
Flip 2
- -
-
- - -
Flip
- -
-
- - -
Folder add
- -
-
- - -
Folder
- -
-
- - -
Folder remove
- -
-
- - -
Funnel
- -
-
- - -
Gift
- -
-
- - -
Github
- -
-
- - -
Globe 2
- -
-
- - -
Globe
- -
-
- - -
Google
- -
-
- - -
Grid
- -
-
- - -
Hard drive
- -
-
- - -
Hash
- -
-
- - -
Headphones
- -
-
- - -
Heart
- -
-
- - -
Home
- -
-
- - -
Image
- -
-
- - -
Inbox
- -
-
- - -
Info
- -
-
- - -
Keypad
- -
-
- - -
Layers
- -
-
- - -
Layout
- -
-
- - -
Link 2
- -
-
- - -
Link
- -
-
- - -
Linkedin
- -
-
- - -
List
- -
-
- - -
Loader
- -
-
- - -
Lock
- -
-
- - -
Log in
- -
-
- - -
Log out
- -
-
- - -
Map
- -
-
- - -
Maximize
- -
-
- - -
Menu 2
- -
-
- - -
Menu arrow
- -
-
- - -
Menu
- -
-
- - -
Message circle
- -
-
- - -
Message square
- -
-
- - -
Mic off
- -
-
- - -
Mic
- -
-
- - -
Minimize
- -
-
- - -
Minus circle
- -
-
- - -
Minus
- -
-
- - -
Minus square
- -
-
- - -
Monitor
- -
-
- - -
Moon
- -
-
- - -
More horizontal
- -
-
- - -
More vertical
- -
-
- - -
Move
- -
-
- - -
Music
- -
-
- - -
Navigation 2
- -
-
- - -
Navigation
- -
-
- - -
Npm
- -
-
- - -
Options 2
- -
-
- - -
Options
- -
-
- - -
Pantone
- -
-
- - -
Paper plane
- -
-
- - -
Pause circle
- -
-
- - -
People
- -
-
- - -
Percent
- -
-
- - -
user add
- -
-
- - -
user delete
- -
-
- - -
user done
- -
-
- - -
user
- -
-
- - -
user remove
- -
-
- - -
Phone call
- -
-
- - -
Phone missed
- -
-
- - -
Phone off
- -
-
- - -
Phone
- -
-
- - -
Pie chart
- -
-
- - -
Pin
- -
-
- - -
Play circle
- -
-
- - -
Plus circle
- -
-
- - -
Plus
- -
-
- - -
Plus square
- -
-
- - -
Power
- -
-
- - -
Pricetags
- -
-
- - -
Printer
- -
-
- - -
Question mark circle
- -
-
- - -
Question mark
- -
-
- - -
Radio button off
- -
-
- - -
Radio button on
- -
-
- - -
Radio
- -
-
- - -
Recording
- -
-
- - -
Refresh
- -
-
- - -
Repeat
- -
-
- - -
Rewind left
- -
-
- - -
Rewind right
- -
-
- - -
Save
- -
-
- - -
Scissors
- -
-
- - -
Search
- -
-
- - -
Settings 2
- -
-
- - -
Settings
- -
-
- - -
Shake
- -
-
- - -
Share
- -
-
- - -
Shield off
- -
-
- - -
Shield
- -
-
- - -
Shopping bag
- -
-
- - -
Shopping cart
- -
-
- - -
Shuffle 2
- -
-
- - -
Shuffle
- -
-
- - -
Step backwards
- -
-
- - -
Step forward
- -
-
- - -
Slash
- -
-
- - -
Smartphone
- -
-
- - -
Smiling face
- -
-
- - -
Speaker
- -
-
- - -
Square
- -
-
- - -
Star
- -
-
- - -
Stop circle
- -
-
- - -
Sun
- -
-
- - -
Swap
- -
-
- - -
Sync
- -
-
- - -
Text
- -
-
- - -
Thermometer minus
- -
-
- - -
Thermometer
- -
-
- - -
Thermometer plus
- -
-
- - -
Toggle left
- -
-
- - -
Toggle right
- -
-
- - -
Trash 2
- -
-
- - -
Trash
- -
-
- - -
Trending down
- -
-
- - -
Trending up
- -
-
- - -
Tv
- -
-
- - -
Twitter
- -
-
- - -
Umbrella
- -
-
- - -
Undo
- -
-
- - -
Unlock
- -
-
- - -
Upload
- -
-
- - -
Video off
- -
-
- - -
Video
- -
-
- - -
Volume down
- -
-
- - -
Volume mute
- -
-
- - -
Volume off
- -
-
- - -
Volume up
- -
-
- - -
Wifi off
- -
-
- - -
Wifi
- -
-
-
-
-
-
-
, + +
Invalid input
+ + + Input is invalid + +
+ + +
Valid input
+ +
+ +
Valid input
+ + + + + + + +
+ + + + + + + + +
Activity
+ +
+
+ + +
Alert circle
+ +
+
+ + +
Alert triangle
+ +
+
+ + +
Archive
+ +
+
+ + +
Arrow left
+ +
+
+ + +
Arrow circle down
+ +
+
+ + +
Arrow circle left
+ +
+
+ + +
Arrow circle right
+ +
+
+ + +
Arrow circle up
+ +
+
+ + +
Sort down
+ +
+
+ + +
Sort down
+ +
+
+ + +
Arrow right
+ +
+
+ + +
Arrow alt left
+ +
+
+ + +
Arrow alt down
+ +
+
+ + +
Arrow alt right
+ +
+
+ + +
Arrow alt up
+ +
+
+ + +
Sort left
+ +
+
+ + +
Sort right
+ +
+
+ + +
Sort up
+ +
+
+ + +
Arrow up
+ +
+
+ + +
chevron-double down
+ +
+
+ + +
chevron-double left
+ +
+
+ + +
chevron-double right
+ +
+
+ + +
chevron-double up
+ +
+
+ + +
At
+ +
+
+ + +
Attach 2
+ +
+
+ + +
Attach
+ +
+
+ + +
Award
+ +
+
+ + +
Backspace
+ +
+
+ + +
Bar chart 2
+ +
+
+ + +
Bar chart
+ +
+
+ + +
Battery
+ +
+
+ + +
Behance
+ +
+
+ + +
Bell off
+ +
+
+ + +
Bell
+ +
+
+ + +
Bluetooth
+ +
+
+ + +
Book open
+ +
+
+ + +
Book
+ +
+
+ + +
Bookmark
+ +
+
+ + +
Briefcase
+ +
+
+ + +
Browser
+ +
+
+ + +
Brush
+ +
+
+ + +
Bulb
+ +
+
+ + +
Calendar
+ +
+
+ + +
Camera
+ +
+
+ + +
Car
+ +
+
+ + +
Cast
+ +
+
+ + +
Charging
+ +
+
+ + +
Checkmark circle 2
+ +
+
+ + +
Checkmark circle
+ +
+
+ + +
Checkmark
+ +
+
+ + +
Checkmark square 2
+ +
+
+ + +
Checkmark square
+ +
+
+ + +
Chevron down
+ +
+
+ + +
Chevron left
+ +
+
+ + +
Chevron right
+ +
+
+ + +
Chevron up
+ +
+
+ + +
Clipboard
+ +
+
+ + +
Clock
+ +
+
+ + +
Close circle
+ +
+
+ + +
Close
+ +
+
+ + +
Close square
+ +
+
+ + +
Cloud download
+ +
+
+ + +
Cloud upload
+ +
+
+ + +
Code download
+ +
+
+ + +
Code
+ +
+
+ + +
Collapse
+ +
+
+ + +
Color palette
+ +
+
+ + +
Color picker
+ +
+
+ + +
Compass
+ +
+
+ + +
Copy
+ +
+
+ + +
Corner down left
+ +
+
+ + +
Corner down right
+ +
+
+ + +
Corner left down
+ +
+
+ + +
Corner left up
+ +
+
+ + +
Corner right down
+ +
+
+ + +
Corner right up
+ +
+
+ + +
Corner up left
+ +
+
+ + +
Corner up right
+ +
+
+ + +
Credit card
+ +
+
+ + +
Crop
+ +
+
+ + +
Cube
+ +
+
+ + +
Diagonal arrow left down
+ +
+
+ + +
Diagonal arrow left up
+ +
+
+ + +
Diagonal arrow right down
+ +
+
+ + +
Diagonal arrow right up
+ +
+
+ + +
Done all
+ +
+
+ + +
Download
+ +
+
+ + +
Droplet off
+ +
+
+ + +
Droplet
+ +
+
+ + +
Edit 2
+ +
+
+ + +
Edit
+ +
+
+ + +
Email
+ +
+
+ + +
Expand
+ +
+
+ + +
External link
+ +
+
+ + +
Eye off 2
+ +
+
+ + +
Eye off
+ +
+
+ + +
Eye
+ +
+
+ + +
Facebook
+ +
+
+ + +
File add
+ +
+
+ + +
File
+ +
+
+ + +
File remove
+ +
+
+ + +
File text
+ +
+
+ + +
Film
+ +
+
+ + +
Flag
+ +
+
+ + +
Flash off
+ +
+
+ + +
Flash
+ +
+
+ + +
Flip 2
+ +
+
+ + +
Flip
+ +
+
+ + +
Folder add
+ +
+
+ + +
Folder
+ +
+
+ + +
Folder remove
+ +
+
+ + +
Funnel
+ +
+
+ + +
Gift
+ +
+
+ + +
Github
+ +
+
+ + +
Globe 2
+ +
+
+ + +
Globe
+ +
+
+ + +
Google
+ +
+
+ + +
Grid
+ +
+
+ + +
Hard drive
+ +
+
+ + +
Hash
+ +
+
+ + +
Headphones
+ +
+
+ + +
Heart
+ +
+
+ + +
Home
+ +
+
+ + +
Image
+ +
+
+ + +
Inbox
+ +
+
+ + +
Info
+ +
+
+ + +
Keypad
+ +
+
+ + +
Layers
+ +
+
+ + +
Layout
+ +
+
+ + +
Link 2
+ +
+
+ + +
Link
+ +
+
+ + +
Linkedin
+ +
+
+ + +
List
+ +
+
+ + +
Loader
+ +
+
+ + +
Lock
+ +
+
+ + +
Log in
+ +
+
+ + +
Log out
+ +
+
+ + +
Map
+ +
+
+ + +
Maximize
+ +
+
+ + +
Menu 2
+ +
+
+ + +
Menu arrow
+ +
+
+ + +
Menu
+ +
+
+ + +
Message circle
+ +
+
+ + +
Message square
+ +
+
+ + +
Mic off
+ +
+
+ + +
Mic
+ +
+
+ + +
Minimize
+ +
+
+ + +
Minus circle
+ +
+
+ + +
Minus
+ +
+
+ + +
Minus square
+ +
+
+ + +
Monitor
+ +
+
+ + +
Moon
+ +
+
+ + +
More horizontal
+ +
+
+ + +
More vertical
+ +
+
+ + +
Move
+ +
+
+ + +
Music
+ +
+
+ + +
Navigation 2
+ +
+
+ + +
Navigation
+ +
+
+ + +
Npm
+ +
+
+ + +
Options 2
+ +
+
+ + +
Options
+ +
+
+ + +
Pantone
+ +
+
+ + +
Paper plane
+ +
+
+ + +
Pause circle
+ +
+
+ + +
People
+ +
+
+ + +
Percent
+ +
+
+ + +
user add
+ +
+
+ + +
user delete
+ +
+
+ + +
user done
+ +
+
+ + +
user
+ +
+
+ + +
user remove
+ +
+
+ + +
Phone call
+ +
+
+ + +
Phone missed
+ +
+
+ + +
Phone off
+ +
+
+ + +
Phone
+ +
+
+ + +
Pie chart
+ +
+
+ + +
Pin
+ +
+
+ + +
Play circle
+ +
+
+ + +
Plus circle
+ +
+
+ + +
Plus
+ +
+
+ + +
Plus square
+ +
+
+ + +
Power
+ +
+
+ + +
Pricetags
+ +
+
+ + +
Printer
+ +
+
+ + +
Question mark circle
+ +
+
+ + +
Question mark
+ +
+
+ + +
Radio button off
+ +
+
+ + +
Radio button on
+ +
+
+ + +
Radio
+ +
+
+ + +
Recording
+ +
+
+ + +
Refresh
+ +
+
+ + +
Repeat
+ +
+
+ + +
Rewind left
+ +
+
+ + +
Rewind right
+ +
+
+ + +
Save
+ +
+
+ + +
Scissors
+ +
+
+ + +
Search
+ +
+
+ + +
Settings 2
+ +
+
+ + +
Settings
+ +
+
+ + +
Shake
+ +
+
+ + +
Share
+ +
+
+ + +
Shield off
+ +
+
+ + +
Shield
+ +
+
+ + +
Shopping bag
+ +
+
+ + +
Shopping cart
+ +
+
+ + +
Shuffle 2
+ +
+
+ + +
Shuffle
+ +
+
+ + +
Step backwards
+ +
+
+ + +
Step forward
+ +
+
+ + +
Slash
+ +
+
+ + +
Smartphone
+ +
+
+ + +
Smiling face
+ +
+
+ + +
Speaker
+ +
+
+ + +
Square
+ +
+
+ + +
Star
+ +
+
+ + +
Stop circle
+ +
+
+ + +
Sun
+ +
+
+ + +
Swap
+ +
+
+ + +
Sync
+ +
+
+ + +
Text
+ +
+
+ + +
Thermometer minus
+ +
+
+ + +
Thermometer
+ +
+
+ + +
Thermometer plus
+ +
+
+ + +
Toggle left
+ +
+
+ + +
Toggle right
+ +
+
+ + +
Trash 2
+ +
+
+ + +
Trash
+ +
+
+ + +
Trending down
+ +
+
+ + +
Trending up
+ +
+
+ + +
Tv
+ +
+
+ + +
Twitter
+ +
+
+ + +
Umbrella
+ +
+
+ + +
Undo
+ +
+
+ + +
Unlock
+ +
+
+ + +
Upload
+ +
+
+ + +
Video off
+ +
+
+ + +
Video
+ +
+
+ + +
Volume down
+ +
+
+ + +
Volume mute
+ +
+
+ + +
Volume off
+ +
+
+ + +
Volume up
+ +
+
+ + +
Wifi off
+ +
+
+ + +
Wifi
+ +
+
+
+
+ + + + + , document.getElementById('root') ); From 54766abcab3645081ac9cda7ec1cfcb8b8c08e32 Mon Sep 17 00:00:00 2001 From: Eran Machiels Date: Thu, 26 Nov 2020 12:53:44 +0100 Subject: [PATCH 2/5] WIP --- src/style/base/_variables.scss | 7 +- src/style/components/_navigation.scss | 6 +- www/src/index.tsx | 755 +++++++++++++++++--------- www/webpack.config.js | 2 +- 4 files changed, 507 insertions(+), 263 deletions(-) diff --git a/src/style/base/_variables.scss b/src/style/base/_variables.scss index 45b8e0e..db5c588 100644 --- a/src/style/base/_variables.scss +++ b/src/style/base/_variables.scss @@ -196,7 +196,6 @@ $success-color-active: color('green', 'active'); --primary-color-hover: #{$primary-color-hover}; --primary-color-active: #{$primary-color-active}; --primary-color-light-background: #{$primary-color-light-background}; - --primary-color-shadow-lighter: #{$primary-color-shadow-lighter}; --danger-color: #{$danger-color}; --danger-color-hover: #{$danger-color-hover}; @@ -223,8 +222,8 @@ $panel-gutter: 2rem; * 4. Page */ $page-gutter: 2rem; -$page-side-background-color: mixins.color('gray', 100); -$page-side-border-color: mixins.color('gray', 300); +$page-side-background-color: hsl(0, 0%, 96%); +$page-side-border-color: hsl(0, 0%, 88%); $page-side-gutter: 1rem; $page-header-height: 120px; @@ -581,7 +580,7 @@ $form-field-font-size: 1rem; /** * 9. Navigation */ -$vertical-navigation-border-color: mixins.color('gray', 300); +$vertical-navigation-border-color: hsl(0, 0%, 88%); $vertical-navigation-active-item-background-color: rgba(0, 0, 0, .05); :root { diff --git a/src/style/components/_navigation.scss b/src/style/components/_navigation.scss index 2b1e476..12a90a9 100644 --- a/src/style/components/_navigation.scss +++ b/src/style/components/_navigation.scss @@ -1,4 +1,4 @@ -@use "../base/mixins"; +@use "../base/variables"; .vertical-navigation-container { width: 100%; @@ -51,13 +51,13 @@ } .navigation-primary { - color: mixins.color('deepPurple', 50); + color: variables.color('deep-purple', 'background'); .vertical-navigation-list-item { color: currentColor; } .vertical-navigation-divider { - background: var(--primary-color-shadow-lighter); + background: var(--primary-color-light-background); } } diff --git a/www/src/index.tsx b/www/src/index.tsx index f425b8f..9b9549a 100644 --- a/www/src/index.tsx +++ b/www/src/index.tsx @@ -157,17 +157,17 @@ ReactDom.render( - +
Standard input
Username - +
Input with floating label
- +
@@ -187,7 +187,7 @@ ReactDom.render( }} actions={[ - + ]} valid={true} /> @@ -211,7 +211,7 @@ ReactDom.render( valid /> - +
Valid input
E
- +
- - +
+ + + - test text - Primary + Primary Danger Rood Roze @@ -256,1465 +257,1709 @@ ReactDom.render( - +
Activity
- +
Alert circle
- +
Alert triangle
- +
Archive
- +
Arrow left
- +
Arrow circle down
- +
Arrow circle left
- +
Arrow circle right
- +
Arrow circle up
- +
Sort down
- +
Sort down
- +
Arrow right
- +
Arrow alt left
- +
Arrow alt down
- +
Arrow alt right
- +
Arrow alt up
- +
Sort left
- +
Sort right
- +
Sort up
- +
Arrow up
- +
chevron-double down
- +
chevron-double left
- +
chevron-double right
- +
chevron-double up
- +
At
- +
Attach 2
- +
Attach
- +
Award
- +
Backspace
- +
Bar chart 2
- +
Bar chart
- +
Battery
- +
Behance
- +
Bell off
- +
Bell
- +
Bluetooth
- +
Book open
- +
Book
- +
Bookmark
- +
Briefcase
- +
Browser
- +
Brush
- +
Bulb
- +
Calendar
- +
Camera
- +
Car
- +
Cast
- +
Charging
- +
Checkmark circle 2
- +
Checkmark circle
- +
Checkmark
- +
Checkmark square 2
- +
Checkmark square
- +
Chevron down
- +
Chevron left
- +
Chevron right
- +
Chevron up
- +
Clipboard
- +
Clock
- +
Close circle
- +
Close
- +
Close square
- +
Cloud download
- +
Cloud upload
- +
Code download
- +
Code
- +
Collapse
- +
Color palette
- +
Color picker
- +
Compass
- +
Copy
- +
Corner down left
- +
Corner down right
- +
Corner left down
- +
Corner left up
- +
Corner right down
- +
Corner right up
- +
Corner up left
- +
Corner up right
- +
Credit card
- +
Crop
- +
Cube
- +
Diagonal arrow left down
- +
Diagonal arrow left up
- +
Diagonal arrow right down
- +
Diagonal arrow right up
- +
Done all
- +
Download
- +
Droplet off
- +
Droplet
- +
Edit 2
- +
Edit
- +
Email
- +
Expand
- +
External link
- +
Eye off 2
- +
Eye off
- +
Eye
- +
Facebook
- +
File add
- +
File
- +
File remove
- +
File text
- +
Film
- +
Flag
- +
Flash off
- +
Flash
- +
Flip 2
- +
Flip
- +
Folder add
- +
Folder
- +
Folder remove
- +
Funnel
- +
Gift
- +
Github
- +
Globe 2
- +
Globe
- +
Google
- +
Grid
- +
Hard drive
- +
Hash
- +
Headphones
- +
Heart
- +
Home
- +
Image
- +
Inbox
- +
Info
- +
Keypad
- +
Layers
- +
Layout
- +
Link 2
- +
Link
- +
Linkedin
- +
List
- +
Loader
- +
Lock
- +
Log in
- +
Log out
- +
Map
- +
Maximize
- +
Menu 2
- +
Menu arrow
- +
Menu
- +
Message circle
- +
Message square
- +
Mic off
- +
Mic
- +
Minimize
- +
Minus circle
- +
Minus
- +
Minus square
- +
Monitor
- +
Moon
- +
More horizontal
- +
More vertical
- +
Move
- +
Music
- +
Navigation 2
- +
Navigation
- +
Npm
- +
Options 2
- +
Options
- +
Pantone
- +
Paper plane
- +
Pause circle
- +
People
- +
Percent
- +
user add
- +
user delete
- +
user done
- +
user
- +
user remove
- +
Phone call
- +
Phone missed
- +
Phone off
- +
Phone
- +
Pie chart
- +
Pin
- +
Play circle
- +
Plus circle
- +
Plus
- +
Plus square
- +
Power
- +
Pricetags
- +
Printer
- +
Question mark circle
- +
Question mark
- +
Radio button off
- +
Radio button on
- +
Radio
- +
Recording
- +
Refresh
- +
Repeat
- +
Rewind left
- +
Rewind right
- +
Save
- +
Scissors
- +
Search
- +
Settings 2
- +
Settings
- +
Shake
- +
Share
- +
Shield off
- +
Shield
- +
Shopping bag
- +
Shopping cart
- +
Shuffle 2
- +
Shuffle
- +
Step backwards
- +
Step forward
- +
Slash
- +
Smartphone
- +
Smiling face
- +
Speaker
- +
Square
- +
Star
- +
Stop circle
- +
Sun
- +
Swap
- +
Sync
- +
Text
- +
Thermometer minus
- +
Thermometer
- +
Thermometer plus
- +
Toggle left
- +
Toggle right
- +
Trash 2
- +
Trash
- +
Trending down
- +
Trending up
- +
Tv
- +
Twitter
- +
Umbrella
- +
Undo
- +
Unlock
- +
Upload
- +
Video off
- +
Video
- +
Volume down
- +
Volume mute
- +
Volume off
- +
Volume up
- +
Wifi off
- +
Wifi
@@ -1724,5 +1969,5 @@ ReactDom.render( , - document.getElementById('root') +document.getElementById('root') ); diff --git a/www/webpack.config.js b/www/webpack.config.js index fc6ec09..a84f9dd 100644 --- a/www/webpack.config.js +++ b/www/webpack.config.js @@ -71,7 +71,7 @@ module.exports = { mode: 'development', devServer: { host: 'localhost', - port: 3000, + port: 3333, open: true, historyApiFallback: true, publicPath: '/', From e7ca3e14787b976262d754791344e74d17015af5 Mon Sep 17 00:00:00 2001 From: Eran Machiels Date: Wed, 16 Dec 2020 19:46:23 +0100 Subject: [PATCH 3/5] Added base navigation --- .eslintrc | 2 +- .../Navigation/Horizontal/Divider.tsx | 17 + src/components/Navigation/Horizontal/List.tsx | 31 + .../Navigation/Horizontal/ListItem.tsx | 44 + src/components/Navigation/Navigation.tsx | 22 +- src/components/Page/Page.tsx | 33 +- src/components/Page/PageLeft.tsx | 37 + src/components/Page/PageRight.tsx | 38 + src/components/Page/Side.tsx | 12 +- src/style/base/_typography.scss | 4 + src/style/base/_variables.scss | 4 +- src/style/components/_navigation.scss | 31 +- src/style/components/_page.scss | 28 +- www/src/index.tsx | 3880 +++++++++-------- 14 files changed, 2215 insertions(+), 1968 deletions(-) create mode 100644 src/components/Navigation/Horizontal/Divider.tsx create mode 100644 src/components/Navigation/Horizontal/List.tsx create mode 100644 src/components/Navigation/Horizontal/ListItem.tsx create mode 100644 src/components/Page/PageLeft.tsx create mode 100644 src/components/Page/PageRight.tsx diff --git a/.eslintrc b/.eslintrc index f5b072b..98cbdca 100644 --- a/.eslintrc +++ b/.eslintrc @@ -15,7 +15,7 @@ "node": true, "es6": true }, - "ignorePatterns": ["dist", "setupTests.ts", "babel.config.js"], + "ignorePatterns": ["dist", "setupTests.ts", "babel.config.js", "www"], "rules": { "comma-dangle": "off", "class-methods-use-this": "off", diff --git a/src/components/Navigation/Horizontal/Divider.tsx b/src/components/Navigation/Horizontal/Divider.tsx new file mode 100644 index 0000000..e24d4ad --- /dev/null +++ b/src/components/Navigation/Horizontal/Divider.tsx @@ -0,0 +1,17 @@ +import * as React from 'react'; + +type NavigationDividerProps = React.HTMLAttributes; + +const NavigationDivider = React.forwardRef(( + _, + ref +): React.ReactElement => ( +
+)); + +NavigationDivider.displayName = 'NavigationDivider'; + +export default NavigationDivider; diff --git a/src/components/Navigation/Horizontal/List.tsx b/src/components/Navigation/Horizontal/List.tsx new file mode 100644 index 0000000..01ed89c --- /dev/null +++ b/src/components/Navigation/Horizontal/List.tsx @@ -0,0 +1,31 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import clsx from 'clsx'; + +type NavigationListProps = React.HTMLAttributes; + +const NavigationList = React.forwardRef(( + { + children, + className + }, + ref +): React.ReactElement => ( + +)); + +NavigationList.displayName = 'NavigationList'; +NavigationList.propTypes = { + children: PropTypes.node, + className: PropTypes.string +}; + +export default NavigationList; diff --git a/src/components/Navigation/Horizontal/ListItem.tsx b/src/components/Navigation/Horizontal/ListItem.tsx new file mode 100644 index 0000000..d40b592 --- /dev/null +++ b/src/components/Navigation/Horizontal/ListItem.tsx @@ -0,0 +1,44 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import clsx from 'clsx'; + +interface NavigationListItemProps extends React.HTMLAttributes { + active?: boolean; + icon?: React.ReactElement; +} + +const NavigationListItem = React.forwardRef(( + { + active, + children, + className, + icon + }, + ref +): React.ReactElement => ( +
+ {icon && ( +
+ {icon} +
+ )} + {children} +
+)); + +NavigationListItem.displayName = 'NavigationListItem'; +NavigationListItem.propTypes = { + active: PropTypes.bool, + children: PropTypes.node, + className: PropTypes.string, + icon: PropTypes.element +}; + +export default NavigationListItem; diff --git a/src/components/Navigation/Navigation.tsx b/src/components/Navigation/Navigation.tsx index 2809261..ae26fdd 100644 --- a/src/components/Navigation/Navigation.tsx +++ b/src/components/Navigation/Navigation.tsx @@ -15,20 +15,16 @@ const Navigation = React.forwardRef(( }, ref ): React.ReactElement => ( - - - + {children} + )); Navigation.displayName = 'PageNavigation'; diff --git a/src/components/Page/Page.tsx b/src/components/Page/Page.tsx index 36936e8..19f9bb9 100644 --- a/src/components/Page/Page.tsx +++ b/src/components/Page/Page.tsx @@ -1,18 +1,36 @@ import * as React from 'react'; import clsx from 'clsx'; +import PropTypes from 'prop-types'; import PageHeader from '@/components/Page/Header'; import PageContent from '@/components/Page/Content'; import PageMain from '@/components/Page/Main'; import Side from '@/components/Page/Side'; +import PageRight from '@/components/Page/PageRight'; +import PageLeft from '@/components/Page/PageLeft'; +import { ForwardComponentWithStatics } from '@/components/utils/ForwardComponentWithStatics'; +import PageSide from '@/components/Page/Side'; export interface PageProps extends React.HTMLAttributes { sticky?: boolean; } -const Page = ({ +export interface PageStatics { + Right: typeof PageRight; + Left: typeof PageLeft; + Header: typeof PageHeader; + Content: typeof PageContent; + Side: typeof PageSide; + Main: typeof PageMain; +} + +// Static properties are not given yet, when declaring the card const. Therefore, the error saying +// that Card is missing above CardStatics properties. These will defined after the card component +// is defined. +// @ts-ignore +const Page: ForwardComponentWithStatics = React.forwardRef(({ children, className, -}: React.PropsWithChildren): React.ReactElement => ( +}): React.ReactElement => (
{children}
-); - +)); +Page.displayName = 'Page'; +Page.Right = PageRight; +Page.Left = PageLeft; Page.Header = PageHeader; Page.Content = PageContent; Page.Side = Side; Page.Main = PageMain; +Page.propTypes = { + children: PropTypes.node, + className: PropTypes.string +} + export default Page; diff --git a/src/components/Page/PageLeft.tsx b/src/components/Page/PageLeft.tsx new file mode 100644 index 0000000..865d6c7 --- /dev/null +++ b/src/components/Page/PageLeft.tsx @@ -0,0 +1,37 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import { Variant } from '@/components'; +import PageSide, { Position } from '@/components/Page/Side'; + +export interface PageLeftProps extends React.HTMLAttributes { + fixed?: boolean; + variant?: Variant | string; +} + +const PageLeft = React.forwardRef(( + { + children, + className, + fixed, + }, + ref +): React.ReactElement => ( + + {children} + +)); + +PageLeft.displayName = 'PageLeft'; +PageLeft.propTypes = { + children: PropTypes.node, + className: PropTypes.string, + fixed: PropTypes.bool, + variant: PropTypes.string +} + +export default PageLeft; diff --git a/src/components/Page/PageRight.tsx b/src/components/Page/PageRight.tsx new file mode 100644 index 0000000..ea8fe3c --- /dev/null +++ b/src/components/Page/PageRight.tsx @@ -0,0 +1,38 @@ +import * as React from 'react'; +import PropTypes from 'prop-types'; +import { Variant } from '@/components'; +import PageSide, { Position } from '@/components/Page/Side'; + +export interface PageRightProps extends React.HTMLAttributes { + spaced?: boolean; + fixed?: boolean; + variant?: Variant | string; +} + +const PageRight = React.forwardRef(( + { + children, + className, + fixed, + }, + ref +): React.ReactElement => ( + + {children} + +)); + +PageRight.displayName = 'PageRight'; +PageRight.propTypes = { + children: PropTypes.node, + className: PropTypes.string, + fixed: PropTypes.bool, + +} + +export default PageRight; diff --git a/src/components/Page/Side.tsx b/src/components/Page/Side.tsx index a289b71..614cfd5 100644 --- a/src/components/Page/Side.tsx +++ b/src/components/Page/Side.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; -import { Panel, Variant } from '@/components'; +import { Variant } from '@/components'; export enum Position { LEFT = 'left', @@ -10,7 +10,6 @@ export enum Position { export interface PageSideProps extends React.HTMLAttributes { position?: Position | string; - spaced?: boolean; fixed?: boolean; variant?: Variant | string; } @@ -20,13 +19,11 @@ const PageSide = React.forwardRef(( children, className, position, - spaced, fixed, - variant }, ref ): React.ReactElement => ( - (( fixed && 'page-side-fixed', className )} - spaced={spaced} - variant={variant} > {children} - +
)); PageSide.displayName = 'Side'; @@ -46,7 +41,6 @@ PageSide.propTypes = { children: PropTypes.node, className: PropTypes.string, position: PropTypes.string, - spaced: PropTypes.bool, fixed: PropTypes.bool, variant: PropTypes.string } diff --git a/src/style/base/_typography.scss b/src/style/base/_typography.scss index 77e6cf6..9cd673c 100644 --- a/src/style/base/_typography.scss +++ b/src/style/base/_typography.scss @@ -142,3 +142,7 @@ h6 { .text-secondary { color: variables.color('gray', 'default'); } + +.text-center { + text-align: center; +} diff --git a/src/style/base/_variables.scss b/src/style/base/_variables.scss index db5c588..bba29c6 100644 --- a/src/style/base/_variables.scss +++ b/src/style/base/_variables.scss @@ -222,17 +222,15 @@ $panel-gutter: 2rem; * 4. Page */ $page-gutter: 2rem; -$page-side-background-color: hsl(0, 0%, 96%); +$page-side-background-color: #fff; $page-side-border-color: hsl(0, 0%, 88%); $page-side-gutter: 1rem; -$page-header-height: 120px; :root { --page-gutter: #{$page-gutter}; --page-side-background-color: #{$page-side-background-color}; --page-side-border-color: #{$page-side-border-color}; --page-side-gutter: #{$page-side-gutter}; - --page-header-height: #{$page-header-height} } /** diff --git a/src/style/components/_navigation.scss b/src/style/components/_navigation.scss index 12a90a9..3f8f365 100644 --- a/src/style/components/_navigation.scss +++ b/src/style/components/_navigation.scss @@ -9,10 +9,10 @@ position: relative; .vertical-navigation-top { - min-height: var(--page-header-height); - padding: 0 var(--base-gutter); + padding: var(--base-gutter); display: flex; align-items: center; + flex-direction: column; } .vertical-navigation-divider { @@ -31,13 +31,13 @@ color: currentColor; display: flex; padding: var(--base-gutter); - border-radius: var(--base-border-radius); + position: relative; font: { weight: 500; } &:hover { - background: var(--vertical-navigation-active-item-background-color); + background: var(--vertical-navigation-hover-item-background-color); } .vertical-navigation-list-item-icon { @@ -46,6 +46,27 @@ size: 1.1rem; } } + + &.active { + color: #fff; + background: var(--primary-color); + border-radius: var(--base-border-radius); + + //&:before { + // content: ''; + // position: absolute; + // height: 100%; + // width: 3px; + // background: var(--primary-color); + // border-radius: 0 var(--base-border-radius) var(--base-border-radius) 0; + // left: 0; + // top: 0; + //} + } + + &:not(:last-child) { + margin-bottom: var(--base-gutter); + } } } } @@ -54,7 +75,7 @@ color: variables.color('deep-purple', 'background'); .vertical-navigation-list-item { - color: currentColor; + color: #fff; } .vertical-navigation-divider { diff --git a/src/style/components/_page.scss b/src/style/components/_page.scss index a81df23..c29b3c6 100644 --- a/src/style/components/_page.scss +++ b/src/style/components/_page.scss @@ -2,26 +2,30 @@ .page { display: flex; + flex-flow: row wrap; .page-main { display: flex; flex-direction: column; - flex: 1 1 100%; + flex: 1 1; } .page-header { border-bottom: solid 1px var(--base-border-color); + padding-top: var(--page-gutter); padding-right: var(--page-gutter); padding-left: var(--page-gutter); - height: var(--page-header-height); - display: flex; - align-items: center; + + &:not(.with-title) { + padding-bottom: var(--page-gutter); + } .page-header-title { font-size: 2rem; color: variables.$base-font-color; font-weight: normal; margin: 0; + padding-bottom: var(--page-gutter); } } @@ -30,7 +34,7 @@ } .page-side { - flex: 1 1 auto; + flex: 0 0 auto; background: var(--page-side-background-color); &.page-side-right { @@ -44,7 +48,19 @@ &.page-side-fixed { align-self: flex-start; position: sticky; - top: 0; /* required */ + top: 0; + } + } + + .page-top { + width: 100%; + flex: 0 0 100%; + align-self: flex-start; + z-index: 9999; + + &.page-top-sticky { + position: sticky; + top: 0; } } } diff --git a/www/src/index.tsx b/www/src/index.tsx index 9b9549a..0130513 100644 --- a/www/src/index.tsx +++ b/www/src/index.tsx @@ -1,13 +1,14 @@ import * as React from 'react'; import { useState } from 'react'; import * as ReactDom from 'react-dom'; - import '../../src/style/index.scss'; import { Button, Card, Col, Grid, Icon, Page, Row, SelectField, Tag, TextField, Variant } from '../../src'; +import logo from '@/images/coderan/logo.svg'; import Container from '../../src/components/Container/Container'; import FormGroup from '../../src/components/Form/Group'; import FormLabel from '../../src/components/Form/Label'; import FormMessage from '../../src/components/Form/Message'; +import VerticalNavigation from '../../src/components/Navigation/VerticalNavigation'; const TestControllable = () => { const [value, setValue] = useState(''); @@ -33,1941 +34,1966 @@ const TestControllable = () => { ReactDom.render( - - - - - - - - -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-

Button colors

- -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
- - - - - - - Col 1/1 - - - Col 1/2 - Col 2/2 - + + + + + + + + + }> + Home + + }> + User + + + + + + + + + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+

Button colors

+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + + + + + + Col 1/1 + + + Col 1/2 + Col 2/2 + - - Col 1/3 - Col 2/3 - Col 3/4 - + + Col 1/3 + Col 2/3 + Col 3/4 + - - Col 1/3 - Col 2/3 - Col 3/4 - + + Col 1/3 + Col 2/3 + Col 3/4 + - - Col 1/4 - Col 2/4 - Col 3/4 - Col 4/4 - - - - - - - - - - -
Standard input
- Username - -
+ + Col 1/4 + Col 2/4 + Col 3/4 + Col 4/4 + +
+
+
+
+ + + + + +
Standard input
+ Username + +
- -
Input with floating label
- -
+ +
Input with floating label
+ +
- -
Input with default value
- -
+ +
Input with default value
+ +
- -
Input with actions
- { + +
Input with actions
+ { - }} - actions={[ - - ]} - valid={true} - /> -
+ }} + actions={[ + + ]} + valid={true} + /> +
- -
Invalid input
- - - Input is invalid - -
+ +
Invalid input
+ + + Input is invalid + +
- -
Valid input
- -
- -
Valid input
- - - - - - - -
- -
-
-
- - - - - Primary - Danger - Rood - Roze - Paars - Diep-paars - Indigo - Blauw - Lichtblauw - Teal - Groen - Lichtgroen - Limoen - Geel - Amber - Oranje - Bruin - Grijs - Blauwgrijs - - - - - - - -
Activity
- -
-
- - -
Alert circle
- -
-
- - -
Alert triangle
- -
-
- - -
Archive
- -
-
- - -
Arrow left
- -
-
- - -
Arrow circle down
- -
-
- - -
Arrow circle left
- -
-
- - -
Arrow circle right
- -
-
- - -
Arrow circle up
- -
-
- - -
Sort down
- -
-
- - -
Sort down
- -
-
- - -
Arrow right
- -
-
- - -
Arrow alt left
- -
-
- - -
Arrow alt down
- -
-
- - -
Arrow alt right
- -
-
- - -
Arrow alt up
- -
-
- - -
Sort left
- -
-
- - -
Sort right
- -
-
- - -
Sort up
- -
-
- - -
Arrow up
- -
-
- - -
chevron-double down
- -
-
- - -
chevron-double left
- -
-
- - -
chevron-double right
- -
-
- - -
chevron-double up
- -
-
- - -
At
- -
-
- - -
Attach 2
- -
-
- - -
Attach
- -
-
- - -
Award
- -
-
- - -
Backspace
- -
-
- - -
Bar chart 2
- -
-
- - -
Bar chart
- -
-
- - -
Battery
- -
-
- - -
Behance
- -
-
- - -
Bell off
- -
-
- - -
Bell
- -
-
- - -
Bluetooth
- -
-
- - -
Book open
- -
-
- - -
Book
- -
-
- - -
Bookmark
- -
-
- - -
Briefcase
- -
-
- - -
Browser
- -
-
- - -
Brush
- -
-
- - -
Bulb
- -
-
- - -
Calendar
- -
-
- - -
Camera
- -
-
- - -
Car
- -
-
- - -
Cast
- -
-
- - -
Charging
- -
-
- - -
Checkmark circle 2
- -
-
- - -
Checkmark circle
- -
-
- - -
Checkmark
- -
-
- - -
Checkmark square 2
- -
-
- - -
Checkmark square
- -
-
- - -
Chevron down
- -
-
- - -
Chevron left
- -
-
- - -
Chevron right
- -
-
- - -
Chevron up
- -
-
- - -
Clipboard
- -
-
- - -
Clock
- -
-
- - -
Close circle
- -
-
- - -
Close
- -
-
- - -
Close square
- -
-
- - -
Cloud download
- -
-
- - -
Cloud upload
- -
-
- - -
Code download
- -
-
- - -
Code
- -
-
- - -
Collapse
- -
-
- - -
Color palette
- -
-
- - -
Color picker
- -
-
- - -
Compass
- -
-
- - -
Copy
- -
-
- - -
Corner down left
- -
-
- - -
Corner down right
- -
-
- - -
Corner left down
- -
-
- - -
Corner left up
- -
-
- - -
Corner right down
- -
-
- - -
Corner right up
- -
-
- - -
Corner up left
- -
-
- - -
Corner up right
- -
-
- - -
Credit card
- -
-
- - -
Crop
- -
-
- - -
Cube
- -
-
- - -
Diagonal arrow left down
- -
-
- - -
Diagonal arrow left up
- -
-
- - -
Diagonal arrow right down
- -
-
- - -
Diagonal arrow right up
- -
-
- - -
Done all
- -
-
- - -
Download
- -
-
- - -
Droplet off
- -
-
- - -
Droplet
- -
-
- - -
Edit 2
- -
-
- - -
Edit
- -
-
- - -
Email
- -
-
- - -
Expand
- -
-
- - -
External link
- -
-
- - -
Eye off 2
- -
-
- - -
Eye off
- -
-
- - -
Eye
- -
-
- - -
Facebook
- -
-
- - -
File add
- -
-
- - -
File
- -
-
- - -
File remove
- -
-
- - -
File text
- -
-
- - -
Film
- -
-
- - -
Flag
- -
-
- - -
Flash off
- -
-
- - -
Flash
- -
-
- - -
Flip 2
- -
-
- - -
Flip
- -
-
- - -
Folder add
- -
-
- - -
Folder
- -
-
- - -
Folder remove
- -
-
- - -
Funnel
- -
-
- - -
Gift
- -
-
- - -
Github
- -
-
- - -
Globe 2
- -
-
- - -
Globe
- -
-
- - -
Google
- -
-
- - -
Grid
- -
-
- - -
Hard drive
- -
-
- - -
Hash
- -
-
- - -
Headphones
- -
-
- - -
Heart
- -
-
- - -
Home
- -
-
- - -
Image
- -
-
- - -
Inbox
- -
-
- - -
Info
- -
-
- - -
Keypad
- -
-
- - -
Layers
- -
-
- - -
Layout
- -
-
- - -
Link 2
- -
-
- - -
Link
- -
-
- - -
Linkedin
- -
-
- - -
List
- -
-
- - -
Loader
- -
-
- - -
Lock
- -
-
- - -
Log in
- -
-
- - -
Log out
- -
-
- - -
Map
- -
-
- - -
Maximize
- -
-
- - -
Menu 2
- -
-
- - -
Menu arrow
- -
-
- - -
Menu
- -
-
- - -
Message circle
- -
-
- - -
Message square
- -
-
- - -
Mic off
- -
-
- - -
Mic
- -
-
- - -
Minimize
- -
-
- - -
Minus circle
- -
-
- - -
Minus
- -
-
- - -
Minus square
- -
-
- - -
Monitor
- -
-
- - -
Moon
- -
-
- - -
More horizontal
- -
-
- - -
More vertical
- -
-
- - -
Move
- -
-
- - -
Music
- -
-
- - -
Navigation 2
- -
-
- - -
Navigation
- -
-
- - -
Npm
- -
-
- - -
Options 2
- -
-
- - -
Options
- -
-
- - -
Pantone
- -
-
- - -
Paper plane
- -
-
- - -
Pause circle
- -
-
- - -
People
- -
-
- - -
Percent
- -
-
- - -
user add
- -
-
- - -
user delete
- -
-
- - -
user done
- -
-
- - -
user
- -
-
- - -
user remove
- -
-
- - -
Phone call
- -
-
- - -
Phone missed
- -
-
- - -
Phone off
- -
-
- - -
Phone
- -
-
- - -
Pie chart
- -
-
- - -
Pin
- -
-
- - -
Play circle
- -
-
- - -
Plus circle
- -
-
- - -
Plus
- -
-
- - -
Plus square
- -
-
- - -
Power
- -
-
- - -
Pricetags
- -
-
- - -
Printer
- -
-
- - -
Question mark circle
- -
-
- - -
Question mark
- -
-
- - -
Radio button off
- -
-
- - -
Radio button on
- -
-
- - -
Radio
- -
-
- - -
Recording
- -
-
- - -
Refresh
- -
-
- - -
Repeat
- -
-
- - -
Rewind left
- -
-
- - -
Rewind right
- -
-
- - -
Save
- -
-
- - -
Scissors
- -
-
- - -
Search
- -
-
- - -
Settings 2
- -
-
- - -
Settings
- -
-
- - -
Shake
- -
-
- - -
Share
- -
-
- - -
Shield off
- -
-
- - -
Shield
- -
-
- - -
Shopping bag
- -
-
- - -
Shopping cart
- -
-
- - -
Shuffle 2
- -
-
- - -
Shuffle
- -
-
- - -
Step backwards
- -
-
- - -
Step forward
- -
-
- - -
Slash
- -
-
- - -
Smartphone
- -
-
- - -
Smiling face
- -
-
- - -
Speaker
- -
-
- - -
Square
- -
-
- - -
Star
- -
-
- - -
Stop circle
- -
-
- - -
Sun
- -
-
- - -
Swap
- -
-
- - -
Sync
- -
-
- - -
Text
- -
-
- - -
Thermometer minus
- -
-
- - -
Thermometer
- -
-
- - -
Thermometer plus
- -
-
- - -
Toggle left
- -
-
- - -
Toggle right
- -
-
- - -
Trash 2
- -
-
- - -
Trash
- -
-
- - -
Trending down
- -
-
- - -
Trending up
- -
-
- - -
Tv
- -
-
- - -
Twitter
- -
-
- - -
Umbrella
- -
-
- - -
Undo
- -
-
- - -
Unlock
- -
-
- - -
Upload
- -
-
- - -
Video off
- -
-
- - -
Video
- -
-
- - -
Volume down
- -
-
- - -
Volume mute
- -
-
- - -
Volume off
- -
-
- - -
Volume up
- -
-
- - -
Wifi off
- -
-
- - -
Wifi
- -
-
-
-
-
-
+ +
Valid input
+ +
+ +
Valid input
+ + + + + + + +
+ +
+
+
+ + + + + Primary + Danger + Rood + Roze + Paars + Diep-paars + Indigo + Blauw + Lichtblauw + Teal + Groen + Lichtgroen + Limoen + Geel + Amber + Oranje + Bruin + Grijs + Blauwgrijs + + + + + + + +
Activity
+ +
+
+ + +
Alert circle
+ +
+
+ + +
Alert triangle
+ +
+
+ + +
Archive
+ +
+
+ + +
Arrow left
+ +
+
+ + +
Arrow circle down
+ +
+
+ + +
Arrow circle left
+ +
+
+ + +
Arrow circle right
+ +
+
+ + +
Arrow circle up
+ +
+
+ + +
Sort down
+ +
+
+ + +
Sort down
+ +
+
+ + +
Arrow right
+ +
+
+ + +
Arrow alt left
+ +
+
+ + +
Arrow alt down
+ +
+
+ + +
Arrow alt right
+ +
+
+ + +
Arrow alt up
+ +
+
+ + +
Sort left
+ +
+
+ + +
Sort right
+ +
+
+ + +
Sort up
+ +
+
+ + +
Arrow up
+ +
+
+ + +
chevron-double down
+ +
+
+ + +
chevron-double left
+ +
+
+ + +
chevron-double right
+ +
+
+ + +
chevron-double up
+ +
+
+ + +
At
+ +
+
+ + +
Attach 2
+ +
+
+ + +
Attach
+ +
+
+ + +
Award
+ +
+
+ + +
Backspace
+ +
+
+ + +
Bar chart 2
+ +
+
+ + +
Bar chart
+ +
+
+ + +
Battery
+ +
+
+ + +
Behance
+ +
+
+ + +
Bell off
+ +
+
+ + +
Bell
+ +
+
+ + +
Bluetooth
+ +
+
+ + +
Book open
+ +
+
+ + +
Book
+ +
+
+ + +
Bookmark
+ +
+
+ + +
Briefcase
+ +
+
+ + +
Browser
+ +
+
+ + +
Brush
+ +
+
+ + +
Bulb
+ +
+
+ + +
Calendar
+ +
+
+ + +
Camera
+ +
+
+ + +
Car
+ +
+
+ + +
Cast
+ +
+
+ + +
Charging
+ +
+
+ + +
Checkmark circle 2
+ +
+
+ + +
Checkmark circle
+ +
+
+ + +
Checkmark
+ +
+
+ + +
Checkmark square 2
+ +
+
+ + +
Checkmark square
+ +
+
+ + +
Chevron down
+ +
+
+ + +
Chevron left
+ +
+
+ + +
Chevron right
+ +
+
+ + +
Chevron up
+ +
+
+ + +
Clipboard
+ +
+
+ + +
Clock
+ +
+
+ + +
Close circle
+ +
+
+ + +
Close
+ +
+
+ + +
Close square
+ +
+
+ + +
Cloud download
+ +
+
+ + +
Cloud upload
+ +
+
+ + +
Code download
+ +
+
+ + +
Code
+ +
+
+ + +
Collapse
+ +
+
+ + +
Color palette
+ +
+
+ + +
Color picker
+ +
+
+ + +
Compass
+ +
+
+ + +
Copy
+ +
+
+ + +
Corner down left
+ +
+
+ + +
Corner down right
+ +
+
+ + +
Corner left down
+ +
+
+ + +
Corner left up
+ +
+
+ + +
Corner right down
+ +
+
+ + +
Corner right up
+ +
+
+ + +
Corner up left
+ +
+
+ + +
Corner up right
+ +
+
+ + +
Credit card
+ +
+
+ + +
Crop
+ +
+
+ + +
Cube
+ +
+
+ + +
Diagonal arrow left down
+ +
+
+ + +
Diagonal arrow left up
+ +
+
+ + +
Diagonal arrow right down
+ +
+
+ + +
Diagonal arrow right up
+ +
+
+ + +
Done all
+ +
+
+ + +
Download
+ +
+
+ + +
Droplet off
+ +
+
+ + +
Droplet
+ +
+
+ + +
Edit 2
+ +
+
+ + +
Edit
+ +
+
+ + +
Email
+ +
+
+ + +
Expand
+ +
+
+ + +
External link
+ +
+
+ + +
Eye off 2
+ +
+
+ + +
Eye off
+ +
+
+ + +
Eye
+ +
+
+ + +
Facebook
+ +
+
+ + +
File add
+ +
+
+ + +
File
+ +
+
+ + +
File remove
+ +
+
+ + +
File text
+ +
+
+ + +
Film
+ +
+
+ + +
Flag
+ +
+
+ + +
Flash off
+ +
+
+ + +
Flash
+ +
+
+ + +
Flip 2
+ +
+
+ + +
Flip
+ +
+
+ + +
Folder add
+ +
+
+ + +
Folder
+ +
+
+ + +
Folder remove
+ +
+
+ + +
Funnel
+ +
+
+ + +
Gift
+ +
+
+ + +
Github
+ +
+
+ + +
Globe 2
+ +
+
+ + +
Globe
+ +
+
+ + +
Google
+ +
+
+ + +
Grid
+ +
+
+ + +
Hard drive
+ +
+
+ + +
Hash
+ +
+
+ + +
Headphones
+ +
+
+ + +
Heart
+ +
+
+ + +
Home
+ +
+
+ + +
Image
+ +
+
+ + +
Inbox
+ +
+
+ + +
Info
+ +
+
+ + +
Keypad
+ +
+
+ + +
Layers
+ +
+
+ + +
Layout
+ +
+
+ + +
Link 2
+ +
+
+ + +
Link
+ +
+
+ + +
Linkedin
+ +
+
+ + +
List
+ +
+
+ + +
Loader
+ +
+
+ + +
Lock
+ +
+
+ + +
Log in
+ +
+
+ + +
Log out
+ +
+
+ + +
Map
+ +
+
+ + +
Maximize
+ +
+
+ + +
Menu 2
+ +
+
+ + +
Menu arrow
+ +
+
+ + +
Menu
+ +
+
+ + +
Message circle
+ +
+
+ + +
Message square
+ +
+
+ + +
Mic off
+ +
+
+ + +
Mic
+ +
+
+ + +
Minimize
+ +
+
+ + +
Minus circle
+ +
+
+ + +
Minus
+ +
+
+ + +
Minus square
+ +
+
+ + +
Monitor
+ +
+
+ + +
Moon
+ +
+
+ + +
More horizontal
+ +
+
+ + +
More vertical
+ +
+
+ + +
Move
+ +
+
+ + +
Music
+ +
+
+ + +
Navigation 2
+ +
+
+ + +
Navigation
+ +
+
+ + +
Npm
+ +
+
+ + +
Options 2
+ +
+
+ + +
Options
+ +
+
+ + +
Pantone
+ +
+
+ + +
Paper plane
+ +
+
+ + +
Pause circle
+ +
+
+ + +
People
+ +
+
+ + +
Percent
+ +
+
+ + +
user add
+ +
+
+ + +
user delete
+ +
+
+ + +
user done
+ +
+
+ + +
user
+ +
+
+ + +
user remove
+ +
+
+ + +
Phone call
+ +
+
+ + +
Phone missed
+ +
+
+ + +
Phone off
+ +
+
+ + +
Phone
+ +
+
+ + +
Pie chart
+ +
+
+ + +
Pin
+ +
+
+ + +
Play circle
+ +
+
+ + +
Plus circle
+ +
+
+ + +
Plus
+ +
+
+ + +
Plus square
+ +
+
+ + +
Power
+ +
+
+ + +
Pricetags
+ +
+
+ + +
Printer
+ +
+
+ + +
Question mark circle
+ +
+
+ + +
Question mark
+ +
+
+ + +
Radio button off
+ +
+
+ + +
Radio button on
+ +
+
+ + +
Radio
+ +
+
+ + +
Recording
+ +
+
+ + +
Refresh
+ +
+
+ + +
Repeat
+ +
+
+ + +
Rewind left
+ +
+
+ + +
Rewind right
+ +
+
+ + +
Save
+ +
+
+ + +
Scissors
+ +
+
+ + +
Search
+ +
+
+ + +
Settings 2
+ +
+
+ + +
Settings
+ +
+
+ + +
Shake
+ +
+
+ + +
Share
+ +
+
+ + +
Shield off
+ +
+
+ + +
Shield
+ +
+
+ + +
Shopping bag
+ +
+
+ + +
Shopping cart
+ +
+
+ + +
Shuffle 2
+ +
+
+ + +
Shuffle
+ +
+
+ + +
Step backwards
+ +
+
+ + +
Step forward
+ +
+
+ + +
Slash
+ +
+
+ + +
Smartphone
+ +
+
+ + +
Smiling face
+ +
+
+ + +
Speaker
+ +
+
+ + +
Square
+ +
+
+ + +
Star
+ +
+
+ + +
Stop circle
+ +
+
+ + +
Sun
+ +
+
+ + +
Swap
+ +
+
+ + +
Sync
+ +
+
+ + +
Text
+ +
+
+ + +
Thermometer minus
+ +
+
+ + +
Thermometer
+ +
+
+ + +
Thermometer plus
+ +
+
+ + +
Toggle left
+ +
+
+ + +
Toggle right
+ +
+
+ + +
Trash 2
+ +
+
+ + +
Trash
+ +
+
+ + +
Trending down
+ +
+
+ + +
Trending up
+ +
+
+ + +
Tv
+ +
+
+ + +
Twitter
+ +
+
+ + +
Umbrella
+ +
+
+ + +
Undo
+ +
+
+ + +
Unlock
+ +
+
+ + +
Upload
+ +
+
+ + +
Video off
+ +
+
+ + +
Video
+ +
+
+ + +
Volume down
+ +
+
+ + +
Volume mute
+ +
+
+ + +
Volume off
+ +
+
+ + +
Volume up
+ +
+
+ + +
Wifi off
+ +
+
+ + +
Wifi
+ +
+
+
+
+ + + , document.getElementById('root') ); From b65ba5907f3670a813661a7bfe29c4ceaa15fc29 Mon Sep 17 00:00:00 2001 From: Eran Machiels Date: Wed, 16 Dec 2020 22:11:01 +0100 Subject: [PATCH 4/5] WIP --- .../Navigation/Vertical/ListItem.tsx | 4 +- .../Vertical/VerticalNavigationScope.ts | 4 ++ .../Navigation/VerticalNavigation.tsx | 42 +++++++++++++------ src/style/base/_variables.scss | 4 +- src/style/components/_navigation.scss | 38 ++++++++++++----- www/src/index.tsx | 38 ++++++++--------- 6 files changed, 85 insertions(+), 45 deletions(-) create mode 100644 src/components/Navigation/Vertical/VerticalNavigationScope.ts diff --git a/src/components/Navigation/Vertical/ListItem.tsx b/src/components/Navigation/Vertical/ListItem.tsx index d40b592..77bdda6 100644 --- a/src/components/Navigation/Vertical/ListItem.tsx +++ b/src/components/Navigation/Vertical/ListItem.tsx @@ -29,7 +29,9 @@ const NavigationListItem = React.forwardRef )} - {children} + + {children} +
)); diff --git a/src/components/Navigation/Vertical/VerticalNavigationScope.ts b/src/components/Navigation/Vertical/VerticalNavigationScope.ts new file mode 100644 index 0000000..0cacd31 --- /dev/null +++ b/src/components/Navigation/Vertical/VerticalNavigationScope.ts @@ -0,0 +1,4 @@ +export interface VerticalNavigationScope { + collapsed: boolean; + collapse: () => void; +} diff --git a/src/components/Navigation/VerticalNavigation.tsx b/src/components/Navigation/VerticalNavigation.tsx index 83afac7..d092134 100644 --- a/src/components/Navigation/VerticalNavigation.tsx +++ b/src/components/Navigation/VerticalNavigation.tsx @@ -7,6 +7,8 @@ import NavigationTop from '@/components/Navigation/Vertical/Top'; import NavigationList from '@/components/Navigation/Vertical/List'; import NavigationListItem from '@/components/Navigation/Vertical/ListItem'; import NavigationDivider from '@/components/Navigation/Vertical/Divider'; +import { useState } from 'react'; +import { VerticalNavigationScope } from './Vertical/VerticalNavigationScope'; export interface VerticalNavigationStatics { Top: typeof NavigationTop; @@ -17,6 +19,8 @@ export interface VerticalNavigationStatics { export interface SideNavigationProps extends React.HTMLAttributes { variant?: Variant | string; + collapsable?: boolean; + children: React.ReactNode | ((scope: VerticalNavigationScope) => React.ReactNode); } // @ts-ignore @@ -28,18 +32,32 @@ const VerticalNavigation: ForwardComponentWithStatics ( -
- {children} -
- )); + ): React.ReactElement => { + const [collapsed, setCollapsed] = useState(false); + + const makeScope = (): VerticalNavigationScope => ({ + collapsed, + collapse: () => setCollapsed(!collapsed) + }); + + children = typeof children === 'function' + ? (children as (scope: VerticalNavigationScope) => React.ReactNode)(makeScope()) + : children; + + return ( +
+ {children} +
+ ) + }); VerticalNavigation.displayName = 'VerticalNavigation'; VerticalNavigation.propTypes = { diff --git a/src/style/base/_variables.scss b/src/style/base/_variables.scss index bba29c6..9d4beff 100644 --- a/src/style/base/_variables.scss +++ b/src/style/base/_variables.scss @@ -579,9 +579,11 @@ $form-field-font-size: 1rem; * 9. Navigation */ $vertical-navigation-border-color: hsl(0, 0%, 88%); -$vertical-navigation-active-item-background-color: rgba(0, 0, 0, .05); +$vertical-navigation-hover-item-background-color: rgba(0, 0, 0, .05); +$vertical-navigation-active-item-background-color: rgba(0, 0, 0, .1); :root { --vertical-navigation-border-color: #{$vertical-navigation-border-color}; + --vertical-navigation-hover-item-background-color: #{$vertical-navigation-hover-item-background-color}; --vertical-navigation-active-item-background-color: #{$vertical-navigation-active-item-background-color}; } diff --git a/src/style/components/_navigation.scss b/src/style/components/_navigation.scss index 3f8f365..ad93355 100644 --- a/src/style/components/_navigation.scss +++ b/src/style/components/_navigation.scss @@ -40,6 +40,10 @@ background: var(--vertical-navigation-hover-item-background-color); } + &:active { + background: var(--vertical-navigation-active-item-background-color); + } + .vertical-navigation-list-item-icon { margin-right: var(--base-gutter); font: { @@ -51,17 +55,6 @@ color: #fff; background: var(--primary-color); border-radius: var(--base-border-radius); - - //&:before { - // content: ''; - // position: absolute; - // height: 100%; - // width: 3px; - // background: var(--primary-color); - // border-radius: 0 var(--base-border-radius) var(--base-border-radius) 0; - // left: 0; - // top: 0; - //} } &:not(:last-child) { @@ -69,6 +62,29 @@ } } } + + &.is-collapsed { + min-width: auto; + + .vertical-navigation-list-item { + position: relative; + .vertical-navigation-list-item-icon { + margin-right: 0; + } + + .vertical-navigation-list-item-text { + display: none; + } + + &:hover { + white-space: nowrap; + + .vertical-navigation-list-item-text { + display: block; + } + } + } + } } .navigation-primary { diff --git a/www/src/index.tsx b/www/src/index.tsx index 0130513..6df380b 100644 --- a/www/src/index.tsx +++ b/www/src/index.tsx @@ -35,26 +35,24 @@ const TestControllable = () => { ReactDom.render( - - - - - - - - }> - Home - - }> - User - - + + {({ collapse }) => ( + <> + + + + + + + }> + Home + + }> + User + + + + )} From 820ab5858f4c45441a563bd85f57556bf9e619db Mon Sep 17 00:00:00 2001 From: Eran Machiels Date: Mon, 28 Dec 2020 11:02:27 +0100 Subject: [PATCH 5/5] WIP navigation --- .../Navigation/Vertical/ListItem.tsx | 46 +++++++----- .../Navigation/Vertical/NavigationContext.ts | 10 +++ .../Navigation/VerticalNavigation.tsx | 71 ++++++++++++++----- src/components/Overlay/OverlayTrigger.tsx | 6 +- src/components/Overlay/index.tsx | 7 +- src/style/components/_navigation.scss | 13 ++-- www/src/index.tsx | 29 +++++--- 7 files changed, 123 insertions(+), 59 deletions(-) create mode 100644 src/components/Navigation/Vertical/NavigationContext.ts diff --git a/src/components/Navigation/Vertical/ListItem.tsx b/src/components/Navigation/Vertical/ListItem.tsx index 77bdda6..04d82f4 100644 --- a/src/components/Navigation/Vertical/ListItem.tsx +++ b/src/components/Navigation/Vertical/ListItem.tsx @@ -1,9 +1,11 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import clsx from 'clsx'; +import { NavigationContext } from './NavigationContext'; interface NavigationListItemProps extends React.HTMLAttributes { active?: boolean; + content?: React.ReactNode; icon?: React.ReactElement; } @@ -15,25 +17,31 @@ const NavigationListItem = React.forwardRef ( -
- {icon && ( -
- {icon} -
- )} - - {children} - -
-)); +): React.ReactElement => { + return ( + + {() => ( +
+ {icon && ( +
+ {icon} +
+ )} + + {children} + +
+ )} +
+ ) +}); NavigationListItem.displayName = 'NavigationListItem'; NavigationListItem.propTypes = { diff --git a/src/components/Navigation/Vertical/NavigationContext.ts b/src/components/Navigation/Vertical/NavigationContext.ts new file mode 100644 index 0000000..2c8c86e --- /dev/null +++ b/src/components/Navigation/Vertical/NavigationContext.ts @@ -0,0 +1,10 @@ +import { createContext } from 'react'; +export interface NavigationContextProps { + tooltipsWhenCollapsed: boolean; + collapsed: boolean; +} + +export const NavigationContext = createContext({ + tooltipsWhenCollapsed: true, + collapsed: false +}); diff --git a/src/components/Navigation/VerticalNavigation.tsx b/src/components/Navigation/VerticalNavigation.tsx index d092134..9b40ec9 100644 --- a/src/components/Navigation/VerticalNavigation.tsx +++ b/src/components/Navigation/VerticalNavigation.tsx @@ -7,8 +7,9 @@ import NavigationTop from '@/components/Navigation/Vertical/Top'; import NavigationList from '@/components/Navigation/Vertical/List'; import NavigationListItem from '@/components/Navigation/Vertical/ListItem'; import NavigationDivider from '@/components/Navigation/Vertical/Divider'; -import { useState } from 'react'; -import { VerticalNavigationScope } from './Vertical/VerticalNavigationScope'; +import { useEffect, useState } from 'react'; +import { VerticalNavigationScope } from '@/components/Navigation/Vertical/VerticalNavigationScope'; +import { NavigationContext } from './Vertical/NavigationContext'; export interface VerticalNavigationStatics { Top: typeof NavigationTop; @@ -17,26 +18,51 @@ export interface VerticalNavigationStatics { Divider: typeof NavigationDivider; } -export interface SideNavigationProps extends React.HTMLAttributes { +export interface VerticalNavigationProps extends React.HTMLAttributes { + /** + * Variant of the menu. With this prop, the color of the menu can be set. + */ variant?: Variant | string; + /** + * Indicates whether the menu collapse is controllable. + */ collapsable?: boolean; + /** + * Indicating whether the menu is collapsed. Can be used to make the navigation a controllable component + */ + collapsed?: boolean; + /** + * Indicates whether a tooltip with the menu text must be shown when menu is collapsed. Default: true + */ + tooltipsWhenCollapsed?: boolean; + /** + * Children of the menu. This can be either a React ChildNode or callback function to access various actions + */ children: React.ReactNode | ((scope: VerticalNavigationScope) => React.ReactNode); } // @ts-ignore -const VerticalNavigation: ForwardComponentWithStatics = +const VerticalNavigation: ForwardComponentWithStatics = React.forwardRef(( { children, className, - variant + variant, + collapsed, + tooltipsWhenCollapsed = true }, ref ): React.ReactElement => { - const [collapsed, setCollapsed] = useState(false); + const [isCollapsed, setCollapsed] = useState(false); + + useEffect(() => { + if (collapsed) { + setCollapsed(collapsed); + } + }, [collapsed]) const makeScope = (): VerticalNavigationScope => ({ - collapsed, + collapsed: isCollapsed, collapse: () => setCollapsed(!collapsed) }); @@ -45,17 +71,24 @@ const VerticalNavigation: ForwardComponentWithStatics - {children} - +
+ {children} +
+ ) }); @@ -63,7 +96,9 @@ VerticalNavigation.displayName = 'VerticalNavigation'; VerticalNavigation.propTypes = { children: PropTypes.node, className: PropTypes.string, - variant: PropTypes.string + variant: PropTypes.string, + collapsed: PropTypes.bool, + tooltipsWhenCollapsed: PropTypes.bool } VerticalNavigation.Top = NavigationTop; diff --git a/src/components/Overlay/OverlayTrigger.tsx b/src/components/Overlay/OverlayTrigger.tsx index a6b7630..125eefe 100644 --- a/src/components/Overlay/OverlayTrigger.tsx +++ b/src/components/Overlay/OverlayTrigger.tsx @@ -5,6 +5,7 @@ import Overlay from '@/components/Overlay/index'; import { Placement, PositioningStrategy } from '@popperjs/core'; import { Trigger, triggerPropTypes } from '@/components/Overlay/Trigger'; import { AnimatePresence } from 'framer-motion'; +import { Modifier } from '@popperjs/core/lib/types'; interface OverlayTriggerProps { arrow?: boolean; @@ -15,6 +16,7 @@ interface OverlayTriggerProps { className?: string; trigger?: Trigger | string; motion?: string; + config?: Array>>; } const OverlayTrigger = ({ @@ -25,7 +27,8 @@ const OverlayTrigger = ({ placement, positionStrategy, trigger = 'hover', - motion + motion, + config }: OverlayTriggerProps): React.ReactElement => { const [shown, setShown] = useState(false); const triggerRef = useRef(); @@ -71,6 +74,7 @@ const OverlayTrigger = ({ placement={placement} positionStrategy={positionStrategy} className={className} + config={config} > {overlay} diff --git a/src/components/Overlay/index.tsx b/src/components/Overlay/index.tsx index 14f4840..3a3cb88 100644 --- a/src/components/Overlay/index.tsx +++ b/src/components/Overlay/index.tsx @@ -20,6 +20,7 @@ interface OverlayProps { arrow?: boolean; positionStrategy?: PositioningStrategy; motion?: string; + config?: Array>>; } const Overlay = ({ @@ -29,7 +30,8 @@ const Overlay = ({ placement = 'top', arrow = true, positionStrategy = 'absolute', - motion: triggerMotion + motion: triggerMotion, + config }: React.PropsWithChildren): React.ReactElement => { const ref = useRef(null); const popper = useRef(); @@ -40,7 +42,8 @@ const Overlay = ({ options: { element: '.arrow' } - }] : []) + }] : []), + ...(config || []) ]); const createPopperOptions = (): PopperOptions => ({ diff --git a/src/style/components/_navigation.scss b/src/style/components/_navigation.scss index ad93355..047b9d2 100644 --- a/src/style/components/_navigation.scss +++ b/src/style/components/_navigation.scss @@ -75,14 +75,6 @@ .vertical-navigation-list-item-text { display: none; } - - &:hover { - white-space: nowrap; - - .vertical-navigation-list-item-text { - display: block; - } - } } } } @@ -98,3 +90,8 @@ background: var(--primary-color-light-background); } } + +.vertical-navigation-tooltip { + margin-left: 0.5rem; + background: #000; +} diff --git a/www/src/index.tsx b/www/src/index.tsx index 08cc18d..79b4808 100644 --- a/www/src/index.tsx +++ b/www/src/index.tsx @@ -3,7 +3,8 @@ import { useState } from 'react'; import * as ReactDom from 'react-dom'; import '../../src/style/index.scss'; import { Button, Card, Col, Grid, Icon, Page, Row, SelectField, Tag, TextField, Variant } from '../../src'; -import logo from '@/images/coderan/logo.svg'; +import logoFull from '@/images/coderan/logo.svg'; +import logoLetter from '@/images/coderan/logo-letter.svg'; import Container from '../../src/components/Container/Container'; import FormGroup from '../../src/components/Form/Group'; import FormLabel from '../../src/components/Form/Label'; @@ -36,21 +37,27 @@ const TestControllable = () => { ReactDom.render( - - {({ collapse }) => ( + + {({ collapse, collapsed }) => ( <> - - + {collapsed ? ( + + ) : ( + + )} - }> - Home - - }> - User - + } + content="Home" + /> + } + content="Tooltips" + /> )}