Skip to content

Commit b8b3149

Browse files
committed
Adds suspend Icon and update icons stories
Signed-off-by: Leonardo Rossi <[email protected]>
1 parent 85757ce commit b8b3149

File tree

4 files changed

+133
-2
lines changed

4 files changed

+133
-2
lines changed

src/components/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const HOVER_EFFECTS_BUTTONS = [BOX_SHADOW, DULLS_BACKGROUND_COLOR, UNDERL
4040
export const MODAL_SIZES = [SMALL, MEDIUM, FULL_WIDTH]
4141
export const BUTTON_BACKGROUNDS_COLOR_HOVER = [ANTI_FLASH_WHITE, FIRE_ENGINE_RED, ALTERNATE_RICH_BLACK]
4242

43-
export const COLORS_ICON = [MAIN_GREEN, WHITE, MAIN_DARK_BLUE, ERROR_RED, WARNING_YELLOW, TERTIARY_BLUE, RICH_BLACK, FLUORESCENT_CYAN, GIANTS_ORANGE, ELECTRIC_PURPLE]
43+
export const COLORS_ICON = [RICH_BLACK, MAIN_GREEN, WHITE, MAIN_DARK_BLUE, ERROR_RED, WARNING_YELLOW, TERTIARY_BLUE, FLUORESCENT_CYAN, GIANTS_ORANGE, ELECTRIC_PURPLE]
4444
export const COLORS_BUTTON = [MAIN_GREEN, DARK_GREEN, LIGHT_GREEN, MAIN_DARK_BLUE, DARK_BLUE, LIGHT_BLUE, WHITE, ERROR_RED, TERTIARY_BLUE, TRANSPARENT, RICH_BLACK, FLUORESCENT_CYAN, GIANTS_ORANGE, ELECTRIC_PURPLE]
4545
export const COLORS_BORDERED_BOX = [MAIN_GREEN, ERROR_RED, WHITE, DARK_BLUE, MAIN_DARK_BLUE, WARNING_YELLOW, TRANSPARENT, LIGHT_BLUE, TERTIARY_BLUE, RICH_BLACK, BLACK_RUSSIAN, FLUORESCENT_CYAN, GIANTS_ORANGE, ELECTRIC_PURPLE]
4646

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import * as React from 'react'
2+
import PropTypes from 'prop-types'
3+
import styles from './Icons.module.css'
4+
import { COLORS_ICON, SIZES, SMALL, MEDIUM, LARGE, MAIN_DARK_BLUE } from '../constants'
5+
6+
const SuspendIcon = ({
7+
color = MAIN_DARK_BLUE,
8+
size = MEDIUM,
9+
disabled = false,
10+
inactive = false
11+
}) => {
12+
let className = `${styles.svgClassName} ` + styles[`${color}`]
13+
if (disabled) {
14+
className += ` ${styles.iconDisabled}`
15+
}
16+
if (inactive) {
17+
className += ` ${styles.iconInactive}`
18+
}
19+
let icon = <></>
20+
21+
switch (size) {
22+
case SMALL:
23+
icon = (
24+
<svg
25+
width={16}
26+
height={16}
27+
viewBox='0 0 16 16'
28+
fill='none'
29+
xmlns='http://www.w3.org/2000/svg'
30+
className={className}
31+
>
32+
<circle cx='8' cy='8' r='6' stroke='currentColor' />
33+
<rect x='6' y='6' width='4' height='4' rx='1' fill='currentColor' />
34+
</svg>
35+
)
36+
break
37+
case MEDIUM:
38+
icon = (
39+
<svg
40+
width={24}
41+
height={24}
42+
viewBox='0 0 24 24'
43+
fill='none'
44+
xmlns='http://www.w3.org/2000/svg'
45+
className={className}
46+
>
47+
<circle cx='12' cy='12' r='9' stroke='currentColor' strokeWidth='1.5' />
48+
<rect x='9' y='9' width='6' height='6' rx='1' fill='currentColor' />
49+
</svg>
50+
)
51+
break
52+
case LARGE:
53+
icon = (
54+
<svg
55+
width={40}
56+
height={40}
57+
viewBox='0 0 40 40'
58+
fill='none'
59+
xmlns='http://www.w3.org/2000/svg'
60+
className={className}
61+
>
62+
<circle cx='20' cy='20' r='15' stroke='currentColor' strokeWidth='2' />
63+
<rect x='15' y='15' width='10' height='10' rx='1.5' fill='currentColor' />
64+
</svg>
65+
)
66+
break
67+
68+
default:
69+
break
70+
}
71+
return icon
72+
}
73+
74+
SuspendIcon.propTypes = {
75+
/**
76+
* color of text, icon and borders
77+
*/
78+
color: PropTypes.oneOf(COLORS_ICON),
79+
/**
80+
* Size
81+
*/
82+
size: PropTypes.oneOf(SIZES),
83+
/**
84+
* disabled
85+
*/
86+
disabled: PropTypes.bool,
87+
/**
88+
* inactive
89+
*/
90+
inactive: PropTypes.bool
91+
}
92+
93+
export default SuspendIcon

src/components/icons/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ import SendIcon from './SendIcon'
178178
import ServiceIcon from './ServiceIcon'
179179
import ServicesWorkingIcon from './ServicesWorkingIcon'
180180
import SlotIcon from './SlotIcon'
181+
import SuspendIcon from './SuspendIcon'
181182
import SwitchIcon from './SwitchIcon'
182183
import SocialDiscordIcon from './SocialDiscordIcon'
183184
import SocialGitHubIcon from './SocialGitHubIcon'
@@ -399,6 +400,7 @@ export default {
399400
ServiceIcon,
400401
ServicesWorkingIcon,
401402
SlotIcon,
403+
SuspendIcon,
402404
SwitchIcon,
403405
SocialDiscordIcon,
404406
SocialGitHubIcon,

src/stories/icons/Icons.stories.jsx

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import CircleCloseIcon from '../../components/icons/CircleCloseIcon'
55
import WorkspaceStaticIcon from '../../components/icons/WorkspaceStaticIcon'
66
import UpgradeIcon from '../../components/icons/UpgradeIcon'
77
import WorkspaceDynamicIcon from '../../components/icons/WorkspaceDynamicIcon'
8-
import { COLORS_ICON, RICH_BLACK } from '../../components/constants'
8+
import { COLORS_ICON, LARGE, MEDIUM, RICH_BLACK, SIZES, SMALL } from '../../components/constants'
99
import icons from '../../components/icons/index.js'
1010

1111
const divStyle = {
@@ -121,3 +121,39 @@ export const AlertIcon = AllSizesIcons(icons.AlertIcon).bind({})
121121
export const ScheduledJobSettingsIcons = AllSizesIcons(icons.ScheduledJobSettingsIcon).bind({})
122122
export const ScheduledJobsSuspendIcons = AllSizesIcons(icons.ScheduledJobsSuspendIcon).bind({})
123123
export const ScheduledJobsDetailIcons = AllSizesIcons(icons.ScheduledJobsDetailIcon).bind({})
124+
125+
const IconPreviewTemplate = ({ iconName, size, color }) => {
126+
const Icon = icons[iconName]
127+
if (!Icon) return <div>Icon not found</div>
128+
129+
return (
130+
<div style={{ backgroundColor: RICH_BLACK, padding: '20px', display: 'flex', gap: '10px' }}>
131+
<Icon size={SMALL} color={color} />
132+
<Icon size={MEDIUM} color={color} />
133+
<Icon size={LARGE} color={color} />
134+
</div>
135+
)
136+
}
137+
138+
export const IconPreview = IconPreviewTemplate.bind({})
139+
IconPreview.args = {
140+
iconName: 'AddIcon',
141+
color: 'rich-black'
142+
}
143+
IconPreview.argTypes = {
144+
iconName: {
145+
control: 'select',
146+
options: Object.keys(icons),
147+
description: 'Select an icon to preview'
148+
},
149+
size: {
150+
control: 'select',
151+
options: SIZES,
152+
description: 'Select icon size'
153+
},
154+
color: {
155+
control: 'select',
156+
options: COLORS_ICON,
157+
description: 'Select icon color'
158+
}
159+
}

0 commit comments

Comments
 (0)