Skip to content

Commit 49e89d5

Browse files
committed
adds LabIcon and ExperimentalTag
Signed-off-by: Leonardo Rossi <[email protected]>
1 parent 789d96e commit 49e89d5

File tree

5 files changed

+107
-0
lines changed

5 files changed

+107
-0
lines changed

src/components/ExperimentalTag.jsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react'
2+
import Tag from './Tag'
3+
import styles from './Tag.module.css'
4+
import { OPACITY_30, SMALL } from './constants'
5+
6+
export default function ExperimentalTag () {
7+
const color = 'tertiary-blue'
8+
return (
9+
<Tag
10+
backgroundColor={color}
11+
text='EXPERIMENTAL'
12+
color={color}
13+
bordered={false}
14+
opaque={OPACITY_30}
15+
paddingClass={styles.experimentalPadding}
16+
fullRounded
17+
platformaticIcon={{ iconName: 'LabIcon', color, size: SMALL }}
18+
/>
19+
)
20+
}

src/components/Tag.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@
1212
}
1313
.padding {
1414
@apply px-3 py-1
15+
}
16+
17+
.experimentalPadding {
18+
@apply text-sm px-2 py-0.5 tracking-[0.15rem] text-[10px];
1519
}

src/components/icons/LabIcon.jsx

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import * as React from 'react'
2+
import styles from './Icons.module.css'
3+
import { SMALL, MEDIUM, LARGE, MAIN_DARK_BLUE } from '../constants'
4+
5+
const LabIcon = ({
6+
color = MAIN_DARK_BLUE,
7+
size = MEDIUM
8+
}) => {
9+
const className = `${styles.svgClassName} ` + styles[`${color}`]
10+
let icon = <></>
11+
12+
switch (size) {
13+
case SMALL:
14+
icon = (
15+
<svg
16+
width={16}
17+
height={16}
18+
viewBox='0 0 16 16'
19+
fill='none'
20+
xmlns='http://www.w3.org/2000/svg'
21+
className={className}
22+
>
23+
<path d='M3.69951 14H8H12.4162C13.1512 14 13.6351 13.2337 13.3191 12.5701L10.0971 5.80399C10.0332 5.66969 10 5.52281 10 5.37406V2H6.66667V5.34087C6.66667 5.51082 6.62336 5.67796 6.54082 5.82652L2.82536 12.5144C2.45506 13.1809 2.93703 14 3.69951 14Z' stroke='none' strokeLinecap='round' strokeLinejoin='round' />
24+
<path d='M5.3335 2L11.3335 2' stroke='none' strokeLinecap='round' strokeLinejoin='round' />
25+
<path d='M4.6665 9.19995H11.9998' stroke='none' />
26+
</svg>
27+
)
28+
break
29+
case MEDIUM:
30+
icon = (
31+
<svg
32+
width={24}
33+
height={24}
34+
viewBox='0 0 24 24'
35+
fill='none'
36+
xmlns='http://www.w3.org/2000/svg'
37+
className={className}
38+
>
39+
<path d='M4.69951 21H12H19.4162C20.1512 21 20.6351 20.2337 20.3191 19.5701L15.0971 8.60399C15.0332 8.46969 15 8.32281 15 8.17406V3H10V8.14087C10 8.31082 9.95669 8.47796 9.87416 8.62652L3.82536 19.5144C3.45506 20.1809 3.93703 21 4.69951 21Z' stroke='none' strokeWidth={1.5} strokeLinecap='round' strokeLinejoin='round' />
40+
<path d='M8 3L17 3' stroke='none' strokeWidth={1.5} strokeLinecap='round' strokeLinejoin='round' />
41+
<path d='M7 13.7999H18' stroke='none' strokeWidth={1.5} />
42+
</svg>
43+
)
44+
break
45+
case LARGE:
46+
icon = (
47+
<svg
48+
width={40}
49+
height={40}
50+
viewBox='0 0 40 40'
51+
fill='none'
52+
xmlns='http://www.w3.org/2000/svg'
53+
className={className}
54+
>
55+
<path d='M6.69951 35H20H33.4162C34.1512 35 34.6351 34.2337 34.3191 33.5701L25.0971 14.204C25.0332 14.0697 25 13.9228 25 13.7741V5H16.6667V13.7409C16.6667 13.9108 16.6234 14.078 16.5408 14.2265L5.82536 33.5144C5.45506 34.1809 5.93703 35 6.69951 35Z' stroke='none' strokeWidth={2} strokeLinecap='round' strokeLinejoin='round' />
56+
<path d='M13.3335 5L28.3335 5' stroke='none' strokeWidth={2} strokeLinecap='round' strokeLinejoin='round' />
57+
<path d='M11.6665 22.9999H29.9998' stroke='none' strokeWidth={2} />
58+
59+
</svg>
60+
)
61+
break
62+
63+
default:
64+
break
65+
}
66+
return icon
67+
}
68+
69+
export default LabIcon

src/components/icons/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ import K8SIcon from './K8SIcon'
125125
import K8SMetricsIcon from './K8SMetricsIcon'
126126
import KeyIcon from './KeyIcon'
127127
import LabelIcon from './LabelIcon'
128+
import LabIcon from './LabIcon'
128129
import LayersIcon from './LayersIcon'
129130
import LensIcon from './LensIcon'
130131
import LiveIcon from './LiveIcon'
@@ -362,6 +363,7 @@ export default {
362363
K8SMetricsIcon,
363364
KeyIcon,
364365
LabelIcon,
366+
LabIcon,
365367
LayersIcon,
366368
LensIcon,
367369
LiveIcon,

src/stories/Tag.stories.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Tag from '../components/Tag'
22
import { ELECTRIC_PURPLE, ERROR_RED, MAIN_GREEN, OPACITY_30, SMALL, TERTIARY_BLUE, WARNING_YELLOW, WHITE } from '../components/constants'
3+
import ExperimentalTag from '../components/ExperimentalTag'
34
export default {
45
title: 'Platformatic/Tag',
56
component: Tag,
@@ -71,3 +72,14 @@ export const MultiColor = {
7172
colors: [ERROR_RED, TERTIARY_BLUE, WHITE, WARNING_YELLOW, ELECTRIC_PURPLE, MAIN_GREEN]
7273
}
7374
}
75+
76+
const ExperimentalTemplate = (args) => {
77+
return (
78+
<div className='bg-black-russian h-full w-full p-8'>
79+
<ExperimentalTag {...args} />
80+
</div>
81+
)
82+
}
83+
84+
export const Experimental = ExperimentalTemplate.bind({})
85+
Experimental.args = {}

0 commit comments

Comments
 (0)