diff --git a/CommonUI/package-lock.json b/CommonUI/package-lock.json index bef706ed48..5889a67da5 100644 --- a/CommonUI/package-lock.json +++ b/CommonUI/package-lock.json @@ -9,9 +9,9 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@fortawesome/fontawesome-svg-core": "^6.1.0", - "@fortawesome/free-regular-svg-icons": "^6.1.0", - "@fortawesome/free-solid-svg-icons": "^6.1.0", + "@fortawesome/fontawesome-svg-core": "^6.1.1", + "@fortawesome/free-regular-svg-icons": "^6.1.1", + "@fortawesome/free-solid-svg-icons": "^6.1.1", "@fortawesome/react-fontawesome": "^0.1.18", "bootstrap": "^5.2.0-beta1", "Common": "file:../Common", @@ -4652,8 +4652,9 @@ }, "node_modules/@fortawesome/fontawesome-svg-core": { "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.1.1.tgz", + "integrity": "sha512-NCg0w2YIp81f4V6cMGD9iomfsIj7GWrqmsa0ZsPh59G7PKiGN1KymZNxmF00ssuAlo/VZmpK6xazsGOwzKYUMg==", "hasInstallScript": true, - "license": "MIT", "dependencies": { "@fortawesome/fontawesome-common-types": "6.1.1" }, @@ -4663,8 +4664,9 @@ }, "node_modules/@fortawesome/free-regular-svg-icons": { "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.1.1.tgz", + "integrity": "sha512-xXiW7hcpgwmWtndKPOzG+43fPH7ZjxOaoeyooptSztGmJxCAflHZxXNK0GcT0uEsR4jTGQAfGklDZE5NHoBhKg==", "hasInstallScript": true, - "license": "(CC-BY-4.0 AND MIT)", "dependencies": { "@fortawesome/fontawesome-common-types": "6.1.1" }, @@ -4674,8 +4676,9 @@ }, "node_modules/@fortawesome/free-solid-svg-icons": { "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.1.1.tgz", + "integrity": "sha512-0/5exxavOhI/D4Ovm2r3vxNojGZioPwmFrKg0ZUH69Q68uFhFPs6+dhAToh6VEQBntxPRYPuT5Cg1tpNa9JUPg==", "hasInstallScript": true, - "license": "(CC-BY-4.0 AND MIT)", "dependencies": { "@fortawesome/fontawesome-common-types": "6.1.1" }, @@ -4685,7 +4688,8 @@ }, "node_modules/@fortawesome/react-fontawesome": { "version": "0.1.18", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.18.tgz", + "integrity": "sha512-RwLIB4TZw0M9gvy5u+TusAA0afbwM4JQIimNH/j3ygd6aIvYPQLqXMhC9ErY26J23rDPyDZldIfPq/HpTTJ/tQ==", "dependencies": { "prop-types": "^15.8.1" }, @@ -5812,24 +5816,32 @@ }, "@fortawesome/fontawesome-svg-core": { "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.1.1.tgz", + "integrity": "sha512-NCg0w2YIp81f4V6cMGD9iomfsIj7GWrqmsa0ZsPh59G7PKiGN1KymZNxmF00ssuAlo/VZmpK6xazsGOwzKYUMg==", "requires": { "@fortawesome/fontawesome-common-types": "6.1.1" } }, "@fortawesome/free-regular-svg-icons": { "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.1.1.tgz", + "integrity": "sha512-xXiW7hcpgwmWtndKPOzG+43fPH7ZjxOaoeyooptSztGmJxCAflHZxXNK0GcT0uEsR4jTGQAfGklDZE5NHoBhKg==", "requires": { "@fortawesome/fontawesome-common-types": "6.1.1" } }, "@fortawesome/free-solid-svg-icons": { "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.1.1.tgz", + "integrity": "sha512-0/5exxavOhI/D4Ovm2r3vxNojGZioPwmFrKg0ZUH69Q68uFhFPs6+dhAToh6VEQBntxPRYPuT5Cg1tpNa9JUPg==", "requires": { "@fortawesome/fontawesome-common-types": "6.1.1" } }, "@fortawesome/react-fontawesome": { "version": "0.1.18", + "resolved": "https://registry.npmjs.org/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.18.tgz", + "integrity": "sha512-RwLIB4TZw0M9gvy5u+TusAA0afbwM4JQIimNH/j3ygd6aIvYPQLqXMhC9ErY26J23rDPyDZldIfPq/HpTTJ/tQ==", "requires": { "prop-types": "^15.8.1" } diff --git a/CommonUI/package.json b/CommonUI/package.json index 982e56b2b7..41f95f6392 100644 --- a/CommonUI/package.json +++ b/CommonUI/package.json @@ -11,9 +11,9 @@ "license": "MIT", "type": "module", "dependencies": { - "@fortawesome/fontawesome-svg-core": "^6.1.0", - "@fortawesome/free-regular-svg-icons": "^6.1.0", - "@fortawesome/free-solid-svg-icons": "^6.1.0", + "@fortawesome/fontawesome-svg-core": "^6.1.1", + "@fortawesome/free-regular-svg-icons": "^6.1.1", + "@fortawesome/free-solid-svg-icons": "^6.1.1", "@fortawesome/react-fontawesome": "^0.1.18", "bootstrap": "^5.2.0-beta1", "Common": "file:../Common", diff --git a/CommonUI/src/Components/Basic/Button/Button.css b/CommonUI/src/Components/Basic/Button/Button.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/CommonUI/src/Components/Basic/Button/Button.tsx b/CommonUI/src/Components/Basic/Button/Button.tsx index 50dd5672d6..aa062a075b 100644 --- a/CommonUI/src/Components/Basic/Button/Button.tsx +++ b/CommonUI/src/Components/Basic/Button/Button.tsx @@ -2,28 +2,39 @@ import React, { FunctionComponent, ReactElement, useEffect } from 'react'; import { MouseOnClick, KeyboardEventProp } from '../../../Types/HtmlEvents'; import ShortcutKey from '../ShortcutKey/ShortcutKey'; import ButtonType from './ButtonTypes'; +import CSS from 'csstype'; +import Icon, { IconProp, SizeProp } from '../Icon/Icon'; export interface ComponentProps { title: string; onClick?: MouseOnClick; disabled?: boolean; - id: string; + id?: string; shortcutKey?: ShortcutKey; type?: ButtonType; isLoading?: boolean; + style?: CSS.Properties; + icon?: IconProp; + showIconOnRight?: boolean; + iconSize?: SizeProp; } -const Button: FunctionComponent = ( - props: ComponentProps -): ReactElement => { - // props validation - if (!props.type) { - props.type = ButtonType.Button; - } - +const Button: FunctionComponent = ({ + title, + onClick, + disabled, + id, + shortcutKey, + type = ButtonType.Button, + isLoading = false, + style, + icon, + iconSize, + showIconOnRight = false, +}: ComponentProps): ReactElement => { useEffect(() => { // componentDidMount - if (props.shortcutKey) { + if (shortcutKey) { window.addEventListener('keydown', (e: KeyboardEventProp) => { return handleKeyboard(e); }); @@ -31,7 +42,7 @@ const Button: FunctionComponent = ( // componentDidUnmount return () => { - if (props.shortcutKey) { + if (shortcutKey) { window.removeEventListener( 'keydown', (e: KeyboardEventProp) => { @@ -46,12 +57,12 @@ const Button: FunctionComponent = ( if ( event.target instanceof HTMLBodyElement && event.key && - props.shortcutKey + shortcutKey ) { switch (event.key) { - case props.shortcutKey.toUpperCase(): - case props.shortcutKey.toLowerCase(): - props.onClick && props.onClick(); + case shortcutKey.toUpperCase(): + case shortcutKey.toLowerCase(): + onClick && onClick(); return; default: return; @@ -61,27 +72,53 @@ const Button: FunctionComponent = ( return ( ); }; diff --git a/CommonUI/src/Components/Basic/Button/DropdownButton.tsx b/CommonUI/src/Components/Basic/Button/DropdownButton.tsx deleted file mode 100644 index e97199efde..0000000000 --- a/CommonUI/src/Components/Basic/Button/DropdownButton.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React, { - MouseEventHandler, - ReactElement, - FunctionComponent, -} from 'react'; -import { faChevronDown } from '@fortawesome/free-solid-svg-icons'; -import './DropdownButton.scss'; -import { MenuOutlineButton } from '../../Dashboard/TopBar/TopbarMenuButton/MenuButton'; - -export interface ComponentProps { - showDropdown?: boolean; - onClick?: MouseEventHandler; - children?: Array; - title: string; -} - -const DropdownButton: FunctionComponent = ({ - onClick, - title, - children, - showDropdown, -}: ComponentProps): ReactElement => { - return ( -
- - {showDropdown && ( -
{children}
- )} -
- ); -}; - -export default DropdownButton; diff --git a/CommonUI/src/Components/Basic/Button/DropdownItem.tsx b/CommonUI/src/Components/Basic/Button/DropdownItem.tsx deleted file mode 100644 index fdff373480..0000000000 --- a/CommonUI/src/Components/Basic/Button/DropdownItem.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import React, { - FunctionComponent, - MouseEventHandler, - ReactElement, -} from 'react'; - -export interface ComponentProps { - title: string; - action?: MouseEventHandler; -} - -const DropdownItem: FunctionComponent = ({ - action, - title, -}: ComponentProps): ReactElement => { - return ( -
- {title} -
- ); -}; - -export default DropdownItem; diff --git a/CommonUI/src/Components/Basic/Button/MenuButton/IconButton.scss b/CommonUI/src/Components/Basic/Button/MenuButton/IconButton.scss new file mode 100644 index 0000000000..fb7968722e --- /dev/null +++ b/CommonUI/src/Components/Basic/Button/MenuButton/IconButton.scss @@ -0,0 +1,11 @@ + +@use '../../../../Styles/BrandColors.scss'; + +.icon { + + color: BrandColors.$color-grey !important; + + &:hover { + color: BrandColors.$color-black !important; + } +} \ No newline at end of file diff --git a/CommonUI/src/Components/Basic/Button/MenuButton/IconButton.tsx b/CommonUI/src/Components/Basic/Button/MenuButton/IconButton.tsx new file mode 100644 index 0000000000..aa846499e5 --- /dev/null +++ b/CommonUI/src/Components/Basic/Button/MenuButton/IconButton.tsx @@ -0,0 +1,48 @@ +import React, { ReactElement, FunctionComponent } from 'react'; +import useComponentOutsideClick from '../../../../Types/UseComponentOutsideClick'; +import Icon, { IconProp, SizeProp } from '../../Icon/Icon'; +import './IconButton.scss'; + +export interface ComponentProps { + icon?: IconProp; + onClick?: Function; + children: ReactElement | Array; + size?: SizeProp; +} + +const IconButton: FunctionComponent = ({ + icon, + onClick, + children, + size, +}: ComponentProps): ReactElement => { + const { ref, isComponentVisible, setIsComponentVisible } = + useComponentOutsideClick(false); + return ( +
+
{ + setIsComponentVisible(!isComponentVisible); + if (onClick) { + onClick(); + } + }} + > + {icon && ( + + )} +
+ {isComponentVisible && ( +
{children}
+ )} +
+ ); +}; + +export default IconButton; diff --git a/CommonUI/src/Components/Basic/Button/DropdownButton.scss b/CommonUI/src/Components/Basic/Button/MenuButton/MenuButton.scss similarity index 100% rename from CommonUI/src/Components/Basic/Button/DropdownButton.scss rename to CommonUI/src/Components/Basic/Button/MenuButton/MenuButton.scss diff --git a/CommonUI/src/Components/Basic/Button/MenuButton/MenuButton.tsx b/CommonUI/src/Components/Basic/Button/MenuButton/MenuButton.tsx new file mode 100644 index 0000000000..3b3e493e53 --- /dev/null +++ b/CommonUI/src/Components/Basic/Button/MenuButton/MenuButton.tsx @@ -0,0 +1,42 @@ +import React, { ReactElement, FunctionComponent } from 'react'; +import './MenuButton.scss'; +import Button from '../Button'; +import useComponentOutsideClick from '../../../../Types/UseComponentOutsideClick'; +import CSS from 'csstype'; +import { IconProp, SizeProp } from '../../Icon/Icon'; + +export interface ComponentProps { + children: ReactElement | Array; + title: string; + style?: CSS.Properties; +} + +const MenuButton: FunctionComponent = ({ + title, + children, + style, +}: ComponentProps): ReactElement => { + const { ref, isComponentVisible, setIsComponentVisible } = + useComponentOutsideClick(false); + + return ( +
+
+ ); +}; + +export default MenuButton; diff --git a/CommonUI/src/Components/Basic/Button/MenuButton/MenuItem.tsx b/CommonUI/src/Components/Basic/Button/MenuButton/MenuItem.tsx new file mode 100644 index 0000000000..fa5f62ff8f --- /dev/null +++ b/CommonUI/src/Components/Basic/Button/MenuButton/MenuItem.tsx @@ -0,0 +1,36 @@ +import Route from 'Common/Types/API/Route'; +import React, { + FunctionComponent, + MouseEventHandler, + ReactElement, +} from 'react'; +import Navigation from '../../../../Utils/Navigation'; + +export interface ComponentProps { + title: string; + onClick?: MouseEventHandler; + route?: Route; +} + +const MenuItem: FunctionComponent = ({ + onClick, + title, + route, +}: ComponentProps): ReactElement => { + return ( +
{ + Navigation.navigate(route); + } + : onClick + } + > + {title} +
+ ); +}; + +export default MenuItem; diff --git a/CommonUI/src/Components/Basic/Button/MenuButton/MenuLegend.tsx b/CommonUI/src/Components/Basic/Button/MenuButton/MenuLegend.tsx new file mode 100644 index 0000000000..35946af2ea --- /dev/null +++ b/CommonUI/src/Components/Basic/Button/MenuButton/MenuLegend.tsx @@ -0,0 +1,17 @@ +import React, { FunctionComponent, ReactElement } from 'react'; + +export interface ComponentProps { + title: string; +} + +const MenuLegend: FunctionComponent = ({ + title, +}: ComponentProps): ReactElement => { + return ( +
+

{title}

+
+ ); +}; + +export default MenuLegend; diff --git a/CommonUI/src/Components/Basic/Icon/Icon.tsx b/CommonUI/src/Components/Basic/Icon/Icon.tsx index e8e382399e..976a146836 100644 --- a/CommonUI/src/Components/Basic/Icon/Icon.tsx +++ b/CommonUI/src/Components/Basic/Icon/Icon.tsx @@ -1,30 +1,73 @@ import React, { FunctionComponent, ReactElement } from 'react'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { + faCircleQuestion, + faUser, + faCog, + faBell, + faFile, + faChevronDown, + faChevronRight, + IconDefinition, + faHome, +} from '@fortawesome/free-solid-svg-icons'; +import Dictionary from 'Common/Types/Dictionary'; export enum SizeProp { - ExtraSmall = 'xs', - Small = 'sm', - Regular = '1x', - Large = 'lg', - ExtraLarge = '3x', + ExtraSmall = '8px', + Smaller = '10px', + Small = '12px', + Regular = '15px', + Large = '18px', + ExtraLarge = '25px', } export enum IconProp { - File = 'file', + File = 'File', + User = 'User', + Settings = 'Settings', + Notification = 'Notifications', + Help = 'Help', + ChevronDown = 'ChevronDown', + ChevronRight = 'ChevronRight', + Home = 'Home', } +const IconDictionary: Dictionary = { + [IconProp.Help]: faCircleQuestion, + [IconProp.User]: faUser, + [IconProp.Notification]: faBell, + [IconProp.Settings]: faCog, + [IconProp.File]: faFile, + [IconProp.ChevronDown]: faChevronDown, + [IconProp.ChevronRight]: faChevronRight, + [IconProp.Home]: faHome, +}; + export interface ComponentProps { icon: IconProp; - size: SizeProp; + size?: SizeProp; + className?: string; } const Icon: FunctionComponent = ({ - icon, size = SizeProp.Regular, + icon, + className, }: ComponentProps): ReactElement => { return ( - - + + ); }; diff --git a/CommonUI/src/Components/Dashboard/Breadcrumbs/BreadcrumbItem.tsx b/CommonUI/src/Components/Dashboard/Breadcrumbs/BreadcrumbItem.tsx new file mode 100644 index 0000000000..539a152952 --- /dev/null +++ b/CommonUI/src/Components/Dashboard/Breadcrumbs/BreadcrumbItem.tsx @@ -0,0 +1,26 @@ +import Route from 'Common/Types/API/Route'; +import React, { FunctionComponent, ReactElement } from 'react'; +import Navigation from '../../../Utils/Navigation'; + +export interface ComponentProps { + title: string; + route?: Route; +} + +const BreadcrumbItem: FunctionComponent = ( + props: ComponentProps +): ReactElement => { + return ( +

{ + if (props.route) { + Navigation.navigate(props.route); + } + }} + > + {props.title} +

+ ); +}; + +export default BreadcrumbItem; diff --git a/CommonUI/src/Components/Dashboard/Container/Breadcrumb/Breadcrumb.scss b/CommonUI/src/Components/Dashboard/Breadcrumbs/Breadcrumbs.scss similarity index 100% rename from CommonUI/src/Components/Dashboard/Container/Breadcrumb/Breadcrumb.scss rename to CommonUI/src/Components/Dashboard/Breadcrumbs/Breadcrumbs.scss diff --git a/CommonUI/src/Components/Dashboard/Container/Breadcrumb/Breadcrumb.tsx b/CommonUI/src/Components/Dashboard/Breadcrumbs/Breadcrumbs.tsx similarity index 65% rename from CommonUI/src/Components/Dashboard/Container/Breadcrumb/Breadcrumb.tsx rename to CommonUI/src/Components/Dashboard/Breadcrumbs/Breadcrumbs.tsx index ba249716a1..3994039bf8 100644 --- a/CommonUI/src/Components/Dashboard/Container/Breadcrumb/Breadcrumb.tsx +++ b/CommonUI/src/Components/Dashboard/Breadcrumbs/Breadcrumbs.tsx @@ -1,25 +1,27 @@ -import { IconProp } from '@fortawesome/fontawesome-svg-core'; -import { faChevronRight } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { FunctionComponent, ReactElement } from 'react'; -import './Breadcrumb.scss'; +import './Breadcrumbs.scss'; +import Icon, { IconProp } from '../../Basic/Icon/Icon'; export interface ComponentProps { icon: IconProp; title: string; - children: Array; + children: ReactElement | Array; } -const Breadcrumb: FunctionComponent = ({ +const Breadcrumbs: FunctionComponent = ({ icon, title, children, }: ComponentProps): ReactElement => { + if (!Array.isArray(children)) { + children = [children]; + } + return (
- +

{title}

@@ -27,7 +29,7 @@ const Breadcrumb: FunctionComponent = ({ return ( {child} - + ); })} @@ -37,4 +39,4 @@ const Breadcrumb: FunctionComponent = ({ ); }; -export default Breadcrumb; +export default Breadcrumbs; diff --git a/CommonUI/src/Components/Dashboard/TopBar/MenuButton/MenuButton.scss b/CommonUI/src/Components/Dashboard/TopBar/MenuButton/MenuButton.scss new file mode 100644 index 0000000000..a7b4859ec1 --- /dev/null +++ b/CommonUI/src/Components/Dashboard/TopBar/MenuButton/MenuButton.scss @@ -0,0 +1,9 @@ + +@use '../../../../Styles/BrandColors.scss'; + +.dropdownButton > .button{ + &:hover { + background: BrandColors.$color-black !important; + color: BrandColors.$color-white !important; + } +} \ No newline at end of file diff --git a/CommonUI/src/Components/Dashboard/TopBar/MenuButton/MenuButton.tsx b/CommonUI/src/Components/Dashboard/TopBar/MenuButton/MenuButton.tsx new file mode 100644 index 0000000000..711f007bed --- /dev/null +++ b/CommonUI/src/Components/Dashboard/TopBar/MenuButton/MenuButton.tsx @@ -0,0 +1,30 @@ +import React, { FunctionComponent, ReactElement } from 'react'; +import MenuButton, { + ComponentProps, +} from '../../../Basic/Button/MenuButton/MenuButton'; +import './MenuButton.scss'; + +const TopBarMenyuButton: FunctionComponent = ( + props: ComponentProps +): ReactElement => { + return ( + + {props.children} + + ); +}; + +export default TopBarMenyuButton; diff --git a/CommonUI/src/Components/Dashboard/TopBar/TopBar.scss b/CommonUI/src/Components/Dashboard/TopBar/TopBar.scss index 3b9b875266..63ab218cab 100644 --- a/CommonUI/src/Components/Dashboard/TopBar/TopBar.scss +++ b/CommonUI/src/Components/Dashboard/TopBar/TopBar.scss @@ -26,7 +26,7 @@ $primaryColor: rgb(246, 248, 250); align-items: center; & > * { - padding-left: 20px; + margin-left: 20px; } } } diff --git a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuItem.scss b/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuItem.scss deleted file mode 100644 index 72db365e1a..0000000000 --- a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuItem.scss +++ /dev/null @@ -1,54 +0,0 @@ -$primaryColor: rgb(246, 248, 250); -$lightDark: #888; -$dark: #333; -$transition: all 0.1s ease; - -.legend { - font-size: 1.3rem; - font-weight: 400; - text-transform: uppercase; - padding: 0 15px; - color: #888; -} - -.menu-item { - display: flex; - justify-content: space-between; - align-items: center; - padding: 2px 0; - cursor: pointer; - - &:hover { - background-color: $primaryColor; - } - - div { - padding: 0 15px; - display: flex; - align-items: center; - - & > * { - padding-right: 10px; - } - - svg { - font-size: 1.1rem !important; - } - - p { - padding: 0; - margin: 0; - font-size: 1.4rem !important; - } - - code { - display: block; - color: #999; - background-color: lighten($dark, 75%); - padding: 0 5px; - margin: 0 1px; - border-radius: 2px; - font-size: 1.3rem; - } - } -} diff --git a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuItem.tsx b/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuItem.tsx deleted file mode 100644 index fcecd36138..0000000000 --- a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuItem.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React, { - ReactElement, - MouseEventHandler, - FunctionComponent, -} from 'react'; -import Shortcut from '../../../Basic/ShortcutKey/Shortcut'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { IconProp } from '@fortawesome/fontawesome-svg-core'; -import Char from 'Common/Types/Char'; - -import './MenuItem.scss'; - -export interface ComponentProps { - text: string; - icon?: IconProp; - shortcuts?: Array; - action?: MouseEventHandler; -} - -const MenuItem: FunctionComponent = ({ - text, - icon, - shortcuts, - action, -}: ComponentProps): ReactElement => { - return ( -
-
- {icon && } -

{text}

-
- {shortcuts && ( -
- -
- )} -
- ); -}; - -export default MenuItem; diff --git a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuLink.scss b/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuLink.scss deleted file mode 100644 index b40fa00e00..0000000000 --- a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuLink.scss +++ /dev/null @@ -1,68 +0,0 @@ -$primaryColor: rgb(246, 248, 250); -$lightDark: #888; -$dark: #333; -$black: black; -$transition: all 0.1s ease; - -.legend { - font-size: 1.3rem; - font-weight: 400; - text-transform: uppercase; - padding: 0 15px; - margin: 0; - margin-bottom: 3px; - color: #888; -} - -.menu-link { - display: flex; - justify-content: space-between; - align-items: center; - padding: 0; - cursor: pointer; - - &:hover { - background-color: $primaryColor; - } - - div { - padding: 0 15px; - display: flex; - align-items: center; - font-size: 1.3rem; - transition: color 0.2s linear; - - & > * { - padding-right: 10px; - } - - svg { - font-size: 1.3rem; - font-weight: 700; - color: $black; - } - - p { - font-weight: 500; - padding: 5px 0; - margin: 0; - font-size: 1.5rem; - color: $black; - padding-right: 7px; - } - - &:hover > svg { - color: $dark; - } - } -} - -@keyframes fadeIn { - from { - opacity: 0; - } - - to { - opacity: 1; - } -} diff --git a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuLinkItem.tsx b/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuLinkItem.tsx deleted file mode 100644 index f95940bcc6..0000000000 --- a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuLinkItem.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React, { ReactElement, FunctionComponent } from 'react'; -import { faUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; - -import './MenuLink.scss'; - -export interface ComponentProps { - text: string; - openInNewTab?: boolean; -} - -const MenuLinkItem: FunctionComponent = ({ - text, - openInNewTab, -}: ComponentProps): ReactElement => { - return ( -
-
-

{text}

- {openInNewTab && } -
-
- ); -}; - -export default MenuLinkItem; diff --git a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/TopbarMenu.tsx b/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/TopbarMenu.tsx deleted file mode 100644 index d15f90e993..0000000000 --- a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/TopbarMenu.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React, { ReactElement, FunctionComponent } from 'react'; -import './MenuItem.tsx'; - -export interface ComponentProps { - legend?: string; - items: Array; -} - -const TopbarMenu: FunctionComponent = ({ - legend, - items, -}: ComponentProps): ReactElement => { - return ( -
-

{legend}

- <> - {items.map((item: ReactElement, index: number) => { - return {item}; - })} - -
- ); -}; - -export default TopbarMenu; diff --git a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton.scss b/CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton.scss deleted file mode 100644 index 95b688e22c..0000000000 --- a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton.scss +++ /dev/null @@ -1,117 +0,0 @@ -$primaryColor: rgb(246, 248, 250); -$lightDark: #000; -$dark: #000; -$transition: all 0.1s ease; - -.buttonLayout { - user-select: none; - position: relative; - - .iconButton { - display: flex; - align-items: center; - flex: 1; - cursor: pointer; - - svg { - color: #000; - font-size: 1.6rem; - } - } - - .button { - display: flex; - justify-content: center; - align-items: center; - font-weight: 300; - font-size: 1.3rem; - outline: 1px solid $lightDark; - color: $lightDark; - border-radius: 100px; - padding: 3px 15px; - cursor: pointer; - transition: $transition; - - svg { - color: #000; - font-size: 1.2rem; - padding-left: 5px; - } - - &:hover { - outline: 1px solid $dark; - color: white; - background-color: $dark; - } - - &:hover > svg { - color: white; - } - } - - .menuButton { - display: flex; - justify-content: center; - align-items: center; - font-size: 1.3rem; - font-weight: 300; - cursor: pointer; - outline: none !important; - - svg { - padding-right: 2px; - font-size: 1.9rem; - } - - &:hover { - outline: none !important; - } - } - - .buttonModal { - position: absolute; - top: 35px; - right: -4px; - padding: 10px 5px; - min-width: 225px; - width: max-content; - max-width: max-content; - height: fit-content; - background-color: white; - border-radius: 7px; - box-shadow: 1px 3px 10px rgba(0, 0, 0, 0.2); - color: darken($primaryColor, 70%); - animation: fadeIn 0.2s linear; - z-index: 20; - - &::after { - content: ''; - position: absolute; - top: -7px; - right: 3px; - width: 15px; - height: 10px; - background-color: white; - box-shadow: -1px -30px 10px rgba(0, 0, 0, 0.6); - clip-path: polygon(50% 0%, 0% 100%, 100% 100%); - } - - .modal-text { - padding: 0 10px; - } - - .text { - font-size: 1.2rem; - } - } -} - -@keyframes fadeIn { - from { - opacity: 0; - } - - to { - opacity: 1; - } -} diff --git a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton.tsx b/CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton.tsx deleted file mode 100644 index 8f1c494493..0000000000 --- a/CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { IconProp } from '@fortawesome/fontawesome-svg-core'; -import React, { - ReactElement, - MouseEventHandler, - FunctionComponent, -} from 'react'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; - -import './MenuButton.scss'; - -export interface MenuIconButtonComponentProps { - icon?: IconProp; - onClick?: MouseEventHandler; - modalContent?: ReactElement; - showModal?: boolean; -} - -export interface MenuOutlineButtonComponentProps - extends MenuIconButtonComponentProps { - text?: string; -} - -export const MenuIconButton: FunctionComponent< - MenuIconButtonComponentProps -> = ({ - icon, - onClick, - showModal, - modalContent, -}: MenuIconButtonComponentProps): ReactElement => { - return ( -
-
- {icon && } -
- {showModal &&
{modalContent}
} -
- ); -}; - -export const MenuOutlineButton: FunctionComponent< - MenuOutlineButtonComponentProps -> = ({ - text, - icon, - onClick, - showModal, - modalContent, -}: MenuOutlineButtonComponentProps): ReactElement => { - return ( -
-
- {text} - {icon && } -
- {showModal &&
{modalContent}
} -
- ); -}; - -const MenuButton: FunctionComponent = ({ - text, - icon, - onClick, - showModal, - modalContent, -}: MenuOutlineButtonComponentProps): ReactElement => { - return ( -
-
- {icon && } - {text} -
- {showModal &&
{modalContent}
} -
- ); -}; - -export default MenuButton; diff --git a/Dashboard/src/Components/UserProfile/UserInfo.tsx b/CommonUI/src/Components/Dashboard/TopBar/UserProfile/UserInfo.tsx similarity index 100% rename from Dashboard/src/Components/UserProfile/UserInfo.tsx rename to CommonUI/src/Components/Dashboard/TopBar/UserProfile/UserInfo.tsx diff --git a/CommonUI/src/Styles/BrandColors.scss b/CommonUI/src/Styles/BrandColors.scss new file mode 100644 index 0000000000..9d0294f2df --- /dev/null +++ b/CommonUI/src/Styles/BrandColors.scss @@ -0,0 +1,10 @@ +// basic colors +$color-black: #000000; +$color-white: #ffffff; +$color-grey: #575757; +$color-light-grey: rgb(144, 139, 139); +$color-very-light-grey: #F3F3F3; + +// shadows +$color-box-shadow: rgba(0, 0, 0, 0.2); +$box-shadow: 1px 3px 10px $color-box-shadow; \ No newline at end of file diff --git a/Dashboard/src/Components/CreateButton.tsx b/Dashboard/src/Components/CreateButton.tsx deleted file mode 100644 index 6c656ee356..0000000000 --- a/Dashboard/src/Components/CreateButton.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import React, { - ReactElement, - FunctionComponent, - useState, - MouseEventHandler, -} from 'react'; -import { MenuOutlineButton } from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton'; -import TopbarMenu from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/TopbarMenu'; -import MenuItem from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuItem'; -import { - faChevronDown, - faFileInvoice, - faRecycle, - faLink, -} from '@fortawesome/free-solid-svg-icons'; - -const CreateButton: FunctionComponent = (): ReactElement => { - const [showList, setShowList] = useState(false); - const toggle: Function = () => { - return setShowList(!showList); - }; - - return ( - , - , - , - ]} - /> - } - /> - ); -}; - -export default CreateButton; diff --git a/Dashboard/src/Components/HelpButton.tsx b/Dashboard/src/Components/HelpButton.tsx deleted file mode 100644 index 4f693a18d6..0000000000 --- a/Dashboard/src/Components/HelpButton.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React, { - FunctionComponent, - MouseEventHandler, - ReactElement, - useState, -} from 'react'; - -import MenuButton from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton'; -import MenuLinkItem from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuLinkItem'; -import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons'; -import TopbarMenu from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/TopbarMenu'; - -const HelpButton: FunctionComponent = (): ReactElement => { - const [showList, setShowList] = useState(false); - const toggle: Function = () => { - return setShowList(!showList); - }; - - return ( - - , - , - , - ]} - /> -
- ]} - /> - - } - /> - ); -}; - -export default HelpButton; diff --git a/Dashboard/src/Components/Monitor/MonitorTable.tsx b/Dashboard/src/Components/Monitor/MonitorTable.tsx index 9285063aa0..82b962589c 100644 --- a/Dashboard/src/Components/Monitor/MonitorTable.tsx +++ b/Dashboard/src/Components/Monitor/MonitorTable.tsx @@ -1,24 +1,15 @@ -import React, { - FunctionComponent, - MouseEventHandler, - ReactElement, - useState, -} from 'react'; +import React, { FunctionComponent, ReactElement } from 'react'; import Container from 'CommonUI/src/Components/Dashboard/Container/Container/Container'; import Pagination from 'CommonUI/src/Components/Dashboard/Container/Container/Pagination'; import Table from 'CommonUI/src/Components/Dashboard/Table/Table'; import Button from 'CommonUI/src/Components/Basic/Button/Button'; import ButtonTypes from 'CommonUI/src/Components/Basic/Button/ButtonTypes'; -import DropdownButton from 'CommonUI/src/Components/Basic/Button/DropdownButton'; -import DropdownItem from 'CommonUI/src/Components/Basic/Button/DropdownItem'; +import MenuButton from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuButton'; +import MenuItem from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuItem'; import ShortcutKey from 'CommonUI/src/Components/Basic/ShortcutKey/ShortcutKey'; import { ColumnSort } from 'CommonUI/src/Components/Dashboard/Table/Type/Table'; const MonitorTable: FunctionComponent = (): ReactElement => { - const [showList, setShowList] = useState(false); - const toggleDropdown: Function = (): void => { - setShowList(!showList); - }; return ( { } headerButtons={[ - - - - - , + + + + + ,
- Edit
); }; diff --git a/Dashboard/src/Components/TopBar/CreateButton.tsx b/Dashboard/src/Components/TopBar/CreateButton.tsx new file mode 100644 index 0000000000..316d45b88c --- /dev/null +++ b/Dashboard/src/Components/TopBar/CreateButton.tsx @@ -0,0 +1,20 @@ +import React, { ReactElement, FunctionComponent } from 'react'; +import MenuButton from 'CommonUI/src/Components/Dashboard/TopBar/MenuButton/MenuButton'; +import MenuItem from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuItem'; +import MenuLegend from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuLegend'; + +const CreateButton: FunctionComponent = (): ReactElement => { + return ( + + + + + + + + + + ); +}; + +export default CreateButton; diff --git a/Dashboard/src/Components/TopBar/HelpButton.tsx b/Dashboard/src/Components/TopBar/HelpButton.tsx new file mode 100644 index 0000000000..054388bbc3 --- /dev/null +++ b/Dashboard/src/Components/TopBar/HelpButton.tsx @@ -0,0 +1,21 @@ +import React, { ReactElement, FunctionComponent } from 'react'; +import MenuItem from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuItem'; +import MenuLegend from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuLegend'; +import IconButton from 'CommonUI/src/Components/Basic/Button/MenuButton/IconButton'; +import { IconProp, SizeProp } from 'CommonUI/src/Components/Basic/Icon/Icon'; + +const CreateButton: FunctionComponent = (): ReactElement => { + return ( + + + + + + + + + + ); +}; + +export default CreateButton; diff --git a/Dashboard/src/Components/TopBar/NotificationButton.tsx b/Dashboard/src/Components/TopBar/NotificationButton.tsx new file mode 100644 index 0000000000..afa7e32ec5 --- /dev/null +++ b/Dashboard/src/Components/TopBar/NotificationButton.tsx @@ -0,0 +1,21 @@ +import React, { ReactElement, FunctionComponent } from 'react'; +import MenuItem from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuItem'; +import MenuLegend from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuLegend'; +import IconButton from 'CommonUI/src/Components/Basic/Button/MenuButton/IconButton'; +import { IconProp, SizeProp } from 'CommonUI/src/Components/Basic/Icon/Icon'; + +const NotificationButton: FunctionComponent = (): ReactElement => { + return ( + + + + + + + + + + ); +}; + +export default NotificationButton; diff --git a/Dashboard/src/Components/TopBar/TopBar.tsx b/Dashboard/src/Components/TopBar/TopBar.tsx index 13059bc9df..fdb7061acd 100644 --- a/Dashboard/src/Components/TopBar/TopBar.tsx +++ b/Dashboard/src/Components/TopBar/TopBar.tsx @@ -1,12 +1,11 @@ import TopBar from 'CommonUI/src/Components/Dashboard/TopBar/TopBar'; import CurrentProject from '../../Components/ProjectPicker/CurrentProject'; import SearchBar from 'CommonUI/src/Components/Dashboard/TopBar/SearchBar/SearchBar'; -import { MenuIconButton } from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton'; -import { faBell } from '@fortawesome/free-solid-svg-icons'; -import CreateButton from '../../Components/CreateButton'; -import HelpButton from '../../Components/HelpButton'; -import UserProfileButton from '../../Components/UserProfile/UserProfileButton'; +import CreateButton from './CreateButton'; +import HelpButton from './HelpButton'; +import UserProfileButton from './UserProfileButton'; import React, { FunctionComponent } from 'react'; +import NotificationButton from './NotificationButton'; const TopBarComponent: FunctionComponent = () => { return ( @@ -16,7 +15,7 @@ const TopBarComponent: FunctionComponent = () => { rightContent={[ , , - , + , , ]} /> diff --git a/Dashboard/src/Components/TopBar/UserProfileButton.tsx b/Dashboard/src/Components/TopBar/UserProfileButton.tsx new file mode 100644 index 0000000000..5c12368aeb --- /dev/null +++ b/Dashboard/src/Components/TopBar/UserProfileButton.tsx @@ -0,0 +1,17 @@ +import React, { ReactElement, FunctionComponent } from 'react'; +import MenuItem from 'CommonUI/src/Components/Basic/Button/MenuButton/MenuItem'; +import UserInfo from 'CommonUI/src/Components/Dashboard/TopBar/UserProfile/UserInfo'; +import { IconProp, SizeProp } from 'CommonUI/src/Components/Basic/Icon/Icon'; +import IconButton from 'CommonUI/src/Components/Basic/Button/MenuButton/IconButton'; + +const CreateButton: FunctionComponent = (): ReactElement => { + return ( + + + + + + ); +}; + +export default CreateButton; diff --git a/Dashboard/src/Components/UserProfile/UserProfileButton.tsx b/Dashboard/src/Components/UserProfile/UserProfileButton.tsx deleted file mode 100644 index 5e3a9ed954..0000000000 --- a/Dashboard/src/Components/UserProfile/UserProfileButton.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import React, { - ReactElement, - FunctionComponent, - useState, - MouseEventHandler, -} from 'react'; -import TopbarMenu from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/TopbarMenu'; -import MenuLinkItem from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenu/MenuLinkItem'; -import { MenuIconButton } from 'CommonUI/src/Components/Dashboard/TopBar/TopbarMenuButton/MenuButton'; -import { faUser } from '@fortawesome/free-solid-svg-icons'; -import UserInfo from './UserInfo'; - -const UserProfileButton: FunctionComponent = (): ReactElement => { - const [showProfile, setShowProfile] = useState(false); - const toggle: Function = () => { - return setShowProfile(!showProfile); - }; - - return ( - , - , - , - ]} - /> - } - /> - ); -}; - -export default UserProfileButton; diff --git a/Dashboard/src/Pages/Home/Home.tsx b/Dashboard/src/Pages/Home/Home.tsx index dbdab80f0c..5d9ffbf6f3 100644 --- a/Dashboard/src/Pages/Home/Home.tsx +++ b/Dashboard/src/Pages/Home/Home.tsx @@ -1,13 +1,20 @@ import React, { FunctionComponent, ReactElement } from 'react'; import PageContainer from 'CommonUI/src/Components/Dashboard/Container/PageContainer/PageContainer'; import PageComponentProps from '../PageComponentProps'; +import Breadcrumbs from 'CommonUI/src/Components/Dashboard/Breadcrumbs/Breadcrumbs'; +import BreadcrumbItem from 'CommonUI/src/Components/Dashboard/Breadcrumbs/BreadcrumbItem'; +import { IconProp } from 'CommonUI/src/Components/Basic/Icon/Icon'; const Home: FunctionComponent = ( _props: PageComponentProps ): ReactElement => { return ( -
+ + + +
Hello
+
); };