Skip to content

Commit aa81284

Browse files
committed
Convert Item to Chakra and add new shadow type
1 parent e7368cf commit aa81284

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

src/@chakra-ui/gatsby-plugin/foundations/shadows.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const shadows = {
1414
light: "0 1px 1px rgba(0, 0, 0, 0.1)",
1515
dark: "0 1px 1px hsla(0,0%,100%,.1)",
1616
},
17+
tableItemBoxHover: "0 0 1px var(--eth-colors-primary)",
1718
}
1819

1920
export default shadows

src/components/TranslationLeaderboard.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,6 @@ import { Option, OptionContainer, OptionText } from "./SharedStyledComponents"
99
import Translation from "./Translation"
1010
import { Box, Flex, useColorModeValue } from "@chakra-ui/react"
1111

12-
const Item = styled.div`
13-
text-decoration: none;
14-
display: flex;
15-
justify-content: space-between;
16-
align-items: center;
17-
color: ${(props) => props.theme.colors.text} !important;
18-
box-shadow: 0 1px 1px ${(props) => props.theme.colors.tableItemBoxShadow};
19-
margin-bottom: 1px;
20-
padding: 0.5rem 1rem;
21-
width: 100%;
22-
color: #000000;
23-
&:hover {
24-
border-radius: 4px;
25-
box-shadow: 0 0 1px ${(props) => props.theme.colors.primary};
26-
background: ${(props) => props.theme.colors.tableBackgroundHover};
27-
}
28-
`
29-
3012
const TextContainer = styled.div`
3113
display: flex;
3214
flex-direction: row;
@@ -96,7 +78,11 @@ const TranslationLeaderboard: React.FC<IProps> = ({
9678
quarterData,
9779
allTimeData,
9880
}) => {
99-
const shadow = useColorModeValue("tableBox.light", "tableBox.dark")
81+
const tableBoxShadow = useColorModeValue("tableBox.light", "tableBox.dark")
82+
const tableItemBoxShadow = useColorModeValue(
83+
"tableItemBox.light",
84+
"tableItemBox.dark"
85+
)
10086
const leaderboardData = {
10187
monthData: reverse(sortBy(monthData.data, ({ user }) => user.totalCosts)),
10288
quarterData: reverse(
@@ -145,7 +131,7 @@ const TranslationLeaderboard: React.FC<IProps> = ({
145131
</OptionText>
146132
</Option>
147133
</OptionContainer>
148-
<Box bg="background" boxShadow={shadow} w="full" mb={8}>
134+
<Box bg="background" boxShadow={tableBoxShadow} w="full" mb={8}>
149135
<Flex
150136
bg="grayBackground"
151137
textDecoration="none"
@@ -197,7 +183,23 @@ const TranslationLeaderboard: React.FC<IProps> = ({
197183
emoji = ":3rd_place_medal:"
198184
}
199185
return (
200-
<Item key={idx}>
186+
<Flex
187+
textDecoration="none"
188+
justifyContent="space-between"
189+
alignItems="center"
190+
color="text"
191+
boxShadow={tableItemBoxShadow}
192+
mb="px"
193+
py={2}
194+
px={4}
195+
w="full"
196+
_hover={{
197+
borderRadius: "base",
198+
boxShadow: "tableItemBoxHover",
199+
bg: "tableBackgroundHover",
200+
}}
201+
key={idx}
202+
>
201203
<Flex>
202204
{emoji ? (
203205
<Width40>
@@ -218,7 +220,7 @@ const TranslationLeaderboard: React.FC<IProps> = ({
218220
<StyledEmoji mr={"0.5rem"} size={1.5} text={":writing:"} />
219221
{user.totalCosts}
220222
</WordsContainer>
221-
</Item>
223+
</Flex>
222224
)
223225
})}
224226
</Box>

0 commit comments

Comments
 (0)