Skip to content

Commit 527a542

Browse files
fix(molecule): btn tertiary icon (#632)
1 parent 7fb8aeb commit 527a542

File tree

3 files changed

+39
-20
lines changed

3 files changed

+39
-20
lines changed

src/Playground.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
import { Box, Heading } from '@chakra-ui/react'
2+
import { BtnTertiary } from './molecules'
23

34
export function Playground(): JSX.Element {
45
return (
56
<Box p="5rem 1rem">
67
<Heading as="h1" size="sm">
78
eClass Design System Playground
89
</Heading>
10+
11+
<BtnTertiary
12+
iconCustom={
13+
<svg xmlns="http://www.w3.org/2000/svg" width={16} height={16} fill="none">
14+
<path
15+
fill="#28A745"
16+
fillRule="evenodd"
17+
d="M0 8c0-4.4 3.6-8 8-8s8 3.6 8 8-3.6 8-8 8-8-3.6-8-8Zm3.6 0L7 11.4 12.4 6 11 4.6l-4 4-2-2L3.6 8Z"
18+
clipRule="evenodd"
19+
/>
20+
</svg>
21+
}
22+
>
23+
ahead
24+
</BtnTertiary>
25+
<BtnTertiary iconStatus="ahead">ahead</BtnTertiary>
26+
<BtnTertiary iconStatus="answer">answer</BtnTertiary>
27+
<BtnTertiary iconStatus="back">back</BtnTertiary>
28+
<BtnTertiary iconStatus="edit">edit</BtnTertiary>
29+
<BtnTertiary iconStatus="delete">delete</BtnTertiary>
30+
<BtnTertiary iconStatus="more">more</BtnTertiary>
31+
<BtnTertiary iconStatus="password">password</BtnTertiary>
32+
<BtnTertiary iconStatus="multimedia">multimedia</BtnTertiary>
33+
<BtnTertiary iconStatus="record">record</BtnTertiary>
34+
<BtnTertiary iconStatus="download">download</BtnTertiary>
35+
<BtnTertiary iconStatus="noIcon">noIcon</BtnTertiary>
936
</Box>
1037
)
1138
}

src/main.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import * as React from 'react'
22
import * as ReactDOM from 'react-dom'
33
import { ChakraProvider } from '@chakra-ui/react'
44

5-
import { Documentation } from './documentation'
6-
// import { Playground } from './Playground'
5+
// import { Documentation } from './documentation'
6+
import { Playground } from './Playground'
77

88
import { theme } from './theme'
99

1010
if (import.meta.env.VITE_REACT_DEPLOY_DOCUMENTATION === 'DOCUMENTATION') {
1111
ReactDOM.render(
1212
<React.StrictMode>
1313
<ChakraProvider theme={theme}>
14-
{/* <Playground /> */}
15-
<Documentation />
14+
<Playground />
15+
{/* <Documentation /> */}
1616
</ChakraProvider>
1717
</React.StrictMode>,
1818
document.getElementById('root')

src/molecules/Buttons/BtnTertiary.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ export function BtnTertiary({
7474
noIcon: <></>,
7575
}
7676

77-
let icon = btnIcons[iconStatus] ?? btnIcons.multimedia
77+
let icon
78+
if (btnIcons[iconStatus] && iconStatus !== 'noIcon') {
79+
icon = btnIcons[iconStatus]
80+
}
7881
if (iconCustom) {
7982
icon = iconCustom
8083
}
84+
8185
const rIcon = rightIcon ? icon : undefined
8286
const lIcon = !rightIcon ? icon : undefined
8387

@@ -95,6 +99,7 @@ export function BtnTertiary({
9599
lineHeight="16px"
96100
textDecorationLine="underline"
97101
borderRadius="12px"
102+
gap="0.5rem"
98103
paddingTop={vars('space-xxs')}
99104
paddingBottom={vars('space-xxs')}
100105
paddingLeft={vars('space-xs')}
@@ -120,21 +125,8 @@ export function BtnTertiary({
120125
bg: 'transparent',
121126
}}
122127
sx={{
123-
'&:hover': {
124-
'svg path': {
125-
fill: `${blue}`,
126-
},
127-
'@media (hover: none)': {
128-
color: `${gray}`,
129-
'svg path': {
130-
fill: colorIcon,
131-
},
132-
},
133-
},
134-
'&:focus': {
135-
'svg path': {
136-
fill: activeWhenPress ? `${blue}` : '',
137-
},
128+
'>span': {
129+
mr: 0,
138130
},
139131
}}
140132
>

0 commit comments

Comments
 (0)