2020-04-26 20:33:39 +00:00
|
|
|
// @flow
|
|
|
|
import * as React from 'react';
|
|
|
|
import styled from 'styled-components';
|
|
|
|
import MemoSvgIcnArrowRight from '../assets/svgr/IcnArrowRight';
|
|
|
|
import MemoSvgIcnChevronDown from '../assets/svgr/IcnChevronDown';
|
|
|
|
import MemoSvgIcnChevronUp from '../assets/svgr/IcnChevronUp';
|
|
|
|
import MemoSvgIcnClock from '../assets/svgr/IcnClock';
|
|
|
|
import MemoSvgIcnEmpty from '../assets/svgr/IcnEmpty';
|
|
|
|
import MemoSvgIcnErrors from '../assets/svgr/IcnErrors';
|
|
|
|
import MemoSvgIcnGitBranch from '../assets/svgr/IcnGitBranch';
|
|
|
|
import MemoSvgIcnGithubLogo from '../assets/svgr/IcnGithubLogo';
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
import MemoSvgIcnBitbucketLogo from '../assets/svgr/IcnBitbucketLogo';
|
2020-04-26 20:33:39 +00:00
|
|
|
import MemoSvgIcnWarning from '../assets/svgr/IcnWarning';
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
import MemoSvgIcnEllipsis from '../assets/svgr/IcnEllipsis';
|
|
|
|
import MemoSvgIcnBurgerMenu from '../assets/svgr/IcnBurgerMenu';
|
|
|
|
import MemoSvgIcnCheckmark from '../assets/svgr/IcnCheckmark';
|
|
|
|
import MemoSvgIcnCookie from '../assets/svgr/IcnCookie';
|
|
|
|
import MemoSvgIcnDragGrip from '../assets/svgr/IcnDragGrip';
|
|
|
|
import MemoSvgIcnElevator from '../assets/svgr/IcnElevator';
|
|
|
|
import MemoSvgIcnEllipsisCircle from '../assets/svgr/IcnEllipsisCircle';
|
|
|
|
import MemoSvgIcnFile from '../assets/svgr/IcnFile';
|
|
|
|
import MemoSvgIcnFolderOpen from '../assets/svgr/IcnFolderOpen';
|
|
|
|
import MemoSvgIcnFolder from '../assets/svgr/IcnFolder';
|
|
|
|
import MemoSvgIcnGear from '../assets/svgr/IcnGear';
|
|
|
|
import MemoSvgIcnGitlabLogo from '../assets/svgr/IcnGitlabLogo';
|
|
|
|
import MemoSvgIcnGUI from '../assets/svgr/IcnGui';
|
|
|
|
import MemoSvgIcnIndendation from '../assets/svgr/IcnIndentation';
|
|
|
|
import MemoSvgIcnMinusCircleFill from '../assets/svgr/IcnMinusCircleFill';
|
|
|
|
import MemoSvgIcnMinusCircle from '../assets/svgr/IcnMinusCircle';
|
|
|
|
import MemoSvgIcnPlaceholder from '../assets/svgr/IcnPlaceholder';
|
|
|
|
import MemoSvgIcnPlay from '../assets/svgr/IcnPlay';
|
|
|
|
import MemoSvgIcnPlus from '../assets/svgr/IcnPlus';
|
|
|
|
import MemoSvgIcnProhibited from '../assets/svgr/IcnProhibited';
|
|
|
|
import MemoSvgIcnQuestionFill from '../assets/svgr/IcnQuestionFill';
|
|
|
|
import MemoSvgIcnQuestion from '../assets/svgr/IcnQuestion';
|
|
|
|
import MemoSvgIcnSearch from '../assets/svgr/IcnSearch';
|
|
|
|
import MemoSvgIcnSecCert from '../assets/svgr/IcnSecCert';
|
2020-06-26 14:45:11 +00:00
|
|
|
import MemoSvgIcnSuccess from '../assets/svgr/IcnSuccess';
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
import MemoSvgIcnSync from '../assets/svgr/IcnSync';
|
|
|
|
import MemoSvgIcnTrashcan from '../assets/svgr/IcnTrashcan';
|
|
|
|
import MemoSvgIcnTriangle from '../assets/svgr/IcnTriangle';
|
|
|
|
import MemoSvgIcnUser from '../assets/svgr/IcnUser';
|
|
|
|
import MemoSvgIcnWarningCircle from '../assets/svgr/IcnWarningCircle';
|
|
|
|
import MemoSvgIcnX from '../assets/svgr/IcnX';
|
|
|
|
import MemoSvgIcnInfo from '../assets/svgr/IcnInfo';
|
2020-07-22 13:13:06 +00:00
|
|
|
import MemoSvgIcnKey from '../assets/svgr/IcnKey';
|
|
|
|
import MemoSvgIcnBrackets from '../assets/svgr/IcnBrackets';
|
2020-04-26 20:33:39 +00:00
|
|
|
|
|
|
|
export const ThemeEnum = {
|
|
|
|
default: 'default',
|
|
|
|
highlight: 'highlight',
|
|
|
|
|
|
|
|
// Colors
|
|
|
|
danger: 'danger',
|
|
|
|
info: 'info',
|
|
|
|
notice: 'notice',
|
|
|
|
success: 'success',
|
|
|
|
surprise: 'surprise',
|
|
|
|
warning: 'warning',
|
|
|
|
};
|
|
|
|
|
|
|
|
type ThemeKeys = $Values<typeof ThemeEnum>;
|
|
|
|
|
|
|
|
export const IconEnum = {
|
|
|
|
arrowRight: 'arrow-right',
|
|
|
|
chevronDown: 'chevron-down',
|
|
|
|
chevronUp: 'chevron-up',
|
|
|
|
clock: 'clock',
|
|
|
|
ellipsis: 'ellipsis',
|
|
|
|
error: 'error',
|
|
|
|
gitBranch: 'git-branch',
|
|
|
|
github: 'github',
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
bitbucket: 'bitbucket',
|
2020-04-26 20:33:39 +00:00
|
|
|
info: 'info',
|
|
|
|
search: 'search',
|
|
|
|
warning: 'warning',
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
burgerMenu: 'burger-menu',
|
|
|
|
checkmark: 'checkmark',
|
|
|
|
cookie: 'cookie',
|
|
|
|
dragGrip: 'drag-grip',
|
|
|
|
elevator: 'elevator',
|
|
|
|
ellipsesCircle: 'ellipses-circle',
|
|
|
|
file: 'file',
|
|
|
|
folder: 'folder',
|
|
|
|
folderOpen: 'folder-open',
|
|
|
|
gear: 'gear',
|
|
|
|
gitlabLogo: 'gitlab-logo',
|
|
|
|
gui: 'gui',
|
|
|
|
indentation: 'indentation',
|
|
|
|
minusCircle: 'minus-circle',
|
|
|
|
minusCircleFill: 'minus-circle-fill',
|
|
|
|
placeholder: 'placeholder',
|
|
|
|
play: 'play',
|
|
|
|
plus: 'plus',
|
|
|
|
prohibited: 'prohibited',
|
|
|
|
questionFill: 'question-fill',
|
|
|
|
question: 'question',
|
|
|
|
secCert: 'sec-cert',
|
2020-06-26 14:45:11 +00:00
|
|
|
success: 'success',
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
sync: 'sync',
|
|
|
|
trashcan: 'trashcan',
|
|
|
|
triangle: 'triangle',
|
|
|
|
user: 'user',
|
|
|
|
warningCircle: 'warning-circle',
|
|
|
|
x: 'x',
|
2020-07-22 13:13:06 +00:00
|
|
|
key: 'key',
|
|
|
|
brackets: 'brackets',
|
2020-04-26 20:33:39 +00:00
|
|
|
|
|
|
|
// Blank icon
|
|
|
|
empty: 'empty',
|
|
|
|
};
|
|
|
|
|
|
|
|
type IconKeys = $Values<typeof IconEnum>;
|
|
|
|
|
|
|
|
type Props = {
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
icon: IconKeys,
|
2020-04-26 20:33:39 +00:00
|
|
|
label?: React.Node,
|
|
|
|
};
|
|
|
|
|
|
|
|
const SvgIconStyled: React.ComponentType<{ theme: ThemeKeys, hasLabel: boolean }> = styled.div`
|
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
svg {
|
|
|
|
flex-shrink: 0;
|
|
|
|
user-select: none;
|
|
|
|
${({ hasLabel }) => (hasLabel ? 'margin-right: var(--padding-xs);' : null)}
|
|
|
|
${({ theme }) => {
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
switch (theme) {
|
|
|
|
case ThemeEnum.danger:
|
|
|
|
case ThemeEnum.info:
|
|
|
|
case ThemeEnum.notice:
|
|
|
|
case ThemeEnum.success:
|
|
|
|
case ThemeEnum.surprise:
|
|
|
|
case ThemeEnum.warning:
|
|
|
|
return `fill: var(--color-${theme}); color: var(--color-font-${theme});`;
|
|
|
|
case ThemeEnum.highlight:
|
|
|
|
return 'fill: var(--hl); color: var(--color-font-danger);';
|
|
|
|
case ThemeEnum.default:
|
|
|
|
default:
|
|
|
|
return 'fill: var(--color-font); color: var(--color-font);';
|
|
|
|
}
|
|
|
|
}}
|
2020-04-26 20:33:39 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
type IconDictionary = {
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
[IconKeys]: [ThemeKeys, React.ComponentType<any>],
|
|
|
|
};
|
2020-04-26 20:33:39 +00:00
|
|
|
|
|
|
|
class SvgIcon extends React.Component<Props> {
|
|
|
|
static icons: IconDictionary = {
|
|
|
|
[IconEnum.arrowRight]: [ThemeEnum.highlight, MemoSvgIcnArrowRight],
|
|
|
|
[IconEnum.chevronDown]: [ThemeEnum.default, MemoSvgIcnChevronDown],
|
|
|
|
[IconEnum.chevronUp]: [ThemeEnum.default, MemoSvgIcnChevronUp],
|
|
|
|
[IconEnum.clock]: [ThemeEnum.default, MemoSvgIcnClock],
|
|
|
|
[IconEnum.ellipsis]: [ThemeEnum.default, MemoSvgIcnEllipsis],
|
|
|
|
[IconEnum.empty]: [ThemeEnum.default, MemoSvgIcnEmpty],
|
|
|
|
[IconEnum.error]: [ThemeEnum.danger, MemoSvgIcnErrors],
|
|
|
|
[IconEnum.gitBranch]: [ThemeEnum.default, MemoSvgIcnGitBranch],
|
|
|
|
[IconEnum.github]: [ThemeEnum.default, MemoSvgIcnGithubLogo],
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
[IconEnum.bitbucket]: [ThemeEnum.default, MemoSvgIcnBitbucketLogo],
|
2020-04-26 20:33:39 +00:00
|
|
|
[IconEnum.info]: [ThemeEnum.highlight, MemoSvgIcnInfo],
|
|
|
|
[IconEnum.search]: [ThemeEnum.default, MemoSvgIcnSearch],
|
|
|
|
[IconEnum.warning]: [ThemeEnum.notice, MemoSvgIcnWarning],
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
[IconEnum.burgerMenu]: [ThemeEnum.default, MemoSvgIcnBurgerMenu],
|
|
|
|
[IconEnum.checkmark]: [ThemeEnum.default, MemoSvgIcnCheckmark],
|
|
|
|
[IconEnum.cookie]: [ThemeEnum.default, MemoSvgIcnCookie],
|
|
|
|
[IconEnum.dragGrip]: [ThemeEnum.default, MemoSvgIcnDragGrip],
|
|
|
|
[IconEnum.elevator]: [ThemeEnum.default, MemoSvgIcnElevator],
|
|
|
|
[IconEnum.ellipsesCircle]: [ThemeEnum.default, MemoSvgIcnEllipsisCircle],
|
|
|
|
[IconEnum.elevator]: [ThemeEnum.default, MemoSvgIcnElevator],
|
|
|
|
[IconEnum.file]: [ThemeEnum.default, MemoSvgIcnFile],
|
|
|
|
[IconEnum.folder]: [ThemeEnum.default, MemoSvgIcnFolder],
|
|
|
|
[IconEnum.folderOpen]: [ThemeEnum.default, MemoSvgIcnFolderOpen],
|
|
|
|
[IconEnum.gear]: [ThemeEnum.default, MemoSvgIcnGear],
|
|
|
|
[IconEnum.gitlabLogo]: [ThemeEnum.default, MemoSvgIcnGitlabLogo],
|
|
|
|
[IconEnum.gui]: [ThemeEnum.default, MemoSvgIcnGUI],
|
|
|
|
[IconEnum.indentation]: [ThemeEnum.default, MemoSvgIcnIndendation],
|
|
|
|
[IconEnum.minusCircle]: [ThemeEnum.default, MemoSvgIcnMinusCircle],
|
|
|
|
[IconEnum.minusCircleFill]: [ThemeEnum.default, MemoSvgIcnMinusCircleFill],
|
|
|
|
[IconEnum.placeholder]: [ThemeEnum.default, MemoSvgIcnPlaceholder],
|
|
|
|
[IconEnum.play]: [ThemeEnum.default, MemoSvgIcnPlay],
|
|
|
|
[IconEnum.plus]: [ThemeEnum.default, MemoSvgIcnPlus],
|
|
|
|
[IconEnum.prohibited]: [ThemeEnum.default, MemoSvgIcnProhibited],
|
|
|
|
[IconEnum.question]: [ThemeEnum.default, MemoSvgIcnQuestion],
|
|
|
|
[IconEnum.questionFill]: [ThemeEnum.default, MemoSvgIcnQuestionFill],
|
|
|
|
[IconEnum.secCert]: [ThemeEnum.default, MemoSvgIcnSecCert],
|
2020-06-26 14:45:11 +00:00
|
|
|
[IconEnum.success]: [ThemeEnum.success, MemoSvgIcnSuccess],
|
Storybook Sidebar Provisioning & WIP Implementation (#2125)
* Migrating dimensions, latest SVG, stubbing sidebar
* Revert "Migrating dimensions, latest SVG, stubbing sidebar"
This reverts commit 5014a68f52ac50fc62db5d42d2b49abda28efaea.
* Revert "Revert "Migrating dimensions, latest SVG, stubbing sidebar""
This reverts commit 28c130c8d8b3993f91f072de106d3ff223d6c55b.
* Post merge bootstrap & build
* Linting
* Updating Story Heirarchy
* Migrating legacy tooltip component
* Reverting spacing integration into core dimensions
* Cleaning up comments, tweaking CSS var usage
* Removing static height
* Cleaning up static CSS values, re-organizing sliding panel, fixing search icon
* adding flow def for autobind in new SB instance
* PR feedback, removing new vars/updating markup
* Fixing lint > flow error on type
2020-05-14 18:00:29 +00:00
|
|
|
[IconEnum.sync]: [ThemeEnum.default, MemoSvgIcnSync],
|
|
|
|
[IconEnum.trashcan]: [ThemeEnum.default, MemoSvgIcnTrashcan],
|
|
|
|
[IconEnum.triangle]: [ThemeEnum.default, MemoSvgIcnTriangle],
|
|
|
|
[IconEnum.user]: [ThemeEnum.default, MemoSvgIcnUser],
|
|
|
|
[IconEnum.warningCircle]: [ThemeEnum.default, MemoSvgIcnWarningCircle],
|
|
|
|
[IconEnum.x]: [ThemeEnum.default, MemoSvgIcnX],
|
2020-07-22 13:13:06 +00:00
|
|
|
[IconEnum.key]: [ThemeEnum.default, MemoSvgIcnKey],
|
|
|
|
[IconEnum.brackets]: [ThemeEnum.default, MemoSvgIcnBrackets],
|
2020-04-26 20:33:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { icon, label } = this.props;
|
|
|
|
|
|
|
|
if (!SvgIcon.icons[icon]) {
|
|
|
|
throw new Error(
|
2020-06-26 14:45:11 +00:00
|
|
|
`Invalid icon "${icon}" used. Must be one of ${Object.values(IconEnum).join('|')}`,
|
2020-04-26 20:33:39 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const [theme, Svg] = SvgIcon.icons[icon];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<SvgIconStyled theme={theme} hasLabel={!!label}>
|
|
|
|
<Svg />
|
|
|
|
{label}
|
|
|
|
</SvgIconStyled>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SvgIcon;
|