Skip to content

Commit baca29a

Browse files
authored
Merge pull request #9519 from ethereum/naked-button
Deprecate NakedButton component
2 parents 7d0ae87 + b7b2ba4 commit baca29a

File tree

5 files changed

+45
-84
lines changed

5 files changed

+45
-84
lines changed

src/components/NakedButton.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/components/Nav/Mobile.tsx

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,19 @@
11
import React from "react"
2+
import { Box, IconButton } from "@chakra-ui/react"
23
import styled from "@emotion/styled"
34
import { useIntl } from "react-intl"
45
import { motion } from "framer-motion"
56

67
import Emoji from "../OldEmoji"
78
import Icon from "../Icon"
89
import Link from "../Link"
9-
import NakedButton from "../NakedButton"
1010
import Search from "../Search"
1111
import Translation from "../Translation"
1212
import { NavLink } from "../SharedStyledComponents"
1313
import { translateMessageId } from "../../utils/translations"
1414

1515
import { ISections } from "./types"
1616

17-
const Container = styled.div`
18-
display: none;
19-
@media (max-width: ${(props) => props.theme.breakpoints.l}) {
20-
display: flex;
21-
}
22-
`
23-
24-
const MenuIcon = styled(Icon)`
25-
fill: ${(props) => props.theme.colors.text};
26-
`
27-
28-
const MenuButton = styled(NakedButton)`
29-
margin-left: 1rem;
30-
`
31-
32-
const OtherIcon = styled(MenuIcon)`
33-
margin-right: 1rem;
34-
`
35-
3617
const MobileModal = styled(motion.div)`
3718
position: fixed;
3819
background: ${(props) => props.theme.colors.modalBackground};
@@ -290,25 +271,33 @@ const MobileNavMenu: React.FC<IProps> = ({
290271
}
291272

292273
return (
293-
<Container>
294-
<MenuButton
274+
<Box
275+
display={{ base: "flex", lg: "none" }}
276+
gap={4}
277+
sx={{ svg: { fill: "body" } }}
278+
>
279+
<IconButton
280+
icon={<Icon name="search" />}
295281
onClick={() => toggleMenu("search")}
296282
aria-label={translateMessageId("aria-toggle-search-button", intl)}
297-
>
298-
<OtherIcon name="search" />
299-
</MenuButton>
300-
<MenuButton
283+
variant="icon"
284+
_hover={{ svg: { fill: "primary" } }}
285+
/>
286+
<IconButton
287+
icon={
288+
<GlyphButton viewBox="0 0 24 40">
289+
<motion.path
290+
variants={glyphPathVariants}
291+
initial={false}
292+
animate={isOpen ? "open" : "closed"}
293+
/>
294+
</GlyphButton>
295+
}
301296
onClick={() => toggleMenu("menu")}
302-
aria-label={translateMessageId("aria-toggle-menu-button", intl)}
303-
>
304-
<GlyphButton viewBox="0 0 24 40">
305-
<motion.path
306-
variants={glyphPathVariants}
307-
initial={false}
308-
animate={isOpen ? "open" : "closed"}
309-
/>
310-
</GlyphButton>
311-
</MenuButton>
297+
aria-label={translateMessageId("aria-toggle-search-button", intl)}
298+
variant="icon"
299+
_hover={{ svg: { fill: "primary" } }}
300+
/>
312301
<MobileModal
313302
animate={isOpen ? "open" : "closed"}
314303
variants={mobileModalVariants}
@@ -381,20 +370,20 @@ const MobileNavMenu: React.FC<IProps> = ({
381370
initial="closed"
382371
>
383372
<BottomItem onClick={() => toggleMenu("search")}>
384-
<MenuIcon name="search" />
373+
<Icon name="search" />
385374
<BottomItemText>
386375
<Translation id="search" />
387376
</BottomItemText>
388377
</BottomItem>
389378
<BottomItem onClick={toggleTheme}>
390-
<MenuIcon name={isDarkTheme ? "darkTheme" : "lightTheme"} />
379+
<Icon name={isDarkTheme ? "darkTheme" : "lightTheme"} />
391380
<BottomItemText>
392381
<Translation id={isDarkTheme ? "dark-mode" : "light-mode"} />
393382
</BottomItemText>
394383
</BottomItem>
395384
<BottomItem onClick={handleClick}>
396385
<BottomLink to={`/languages/${fromPageParameter}`}>
397-
<MenuIcon name="language" />
386+
<Icon name="language" />
398387
<BottomItemText>
399388
<Translation id="languages" />
400389
</BottomItemText>
@@ -418,7 +407,7 @@ const MobileNavMenu: React.FC<IProps> = ({
418407
<Translation id="search-box-blank-state-text" />
419408
</BlankSearchState>
420409
</SearchContainer>
421-
</Container>
410+
</Box>
422411
)
423412
}
424413

src/intl/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"brand-assets": "Brand assets",
1919
"bridges": "Blockchain bridges",
2020
"bug-bounty": "Bug bounty",
21+
"clear": "Clear",
2122
"close": "Close",
2223
"coinbase-logo": "Coinbase logo",
2324
"coinmama-logo": "Coinmama logo",

src/pages/languages.tsx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from "react"
2+
import { IconButton } from "@chakra-ui/react"
23
import styled from "@emotion/styled"
34
import { useLocation } from "@reach/router"
45
import { useIntl } from "react-intl"
@@ -12,7 +13,6 @@ import { Language, languageMetadata } from "../utils/languages"
1213
import { translateMessageId, TranslationKey } from "../utils/translations"
1314
import { CardItem as LangItem } from "../components/SharedStyledComponents"
1415
import Icon from "../components/Icon"
15-
import NakedButton from "../components/NakedButton"
1616

1717
const StyledPage = styled(Page)`
1818
margin-top: 4rem;
@@ -58,17 +58,6 @@ const StyledInput = styled.input`
5858
}
5959
`
6060

61-
const IconButton = styled(NakedButton)`
62-
position: absolute;
63-
top: 50%;
64-
margin-top: -12px;
65-
right: 6px;
66-
`
67-
68-
const ResetIcon = styled(Icon)`
69-
fill: ${(props) => props.theme.colors.text};
70-
`
71-
7261
const LanguagesPage = () => {
7362
const intl = useIntl()
7463
const location = useLocation()
@@ -140,10 +129,16 @@ const LanguagesPage = () => {
140129
placeholder={searchString}
141130
onChange={(e) => setKeyword(e.target.value)}
142131
/>
143-
{keyword === "" ? null : (
144-
<IconButton onClick={resetKeyword}>
145-
<ResetIcon name="close" />
146-
</IconButton>
132+
{keyword !== "" && (
133+
<IconButton
134+
icon={<Icon name="close" />}
135+
onClick={resetKeyword}
136+
position="absolute"
137+
insetInlineEnd={1}
138+
aria-label={translateMessageId("clear", intl)}
139+
variant="icon"
140+
_hover={{ svg: { fill: "primary" } }}
141+
/>
147142
)}
148143
</Form>
149144
<LangContainer>

src/pages/run-a-node.tsx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import Link from "../components/Link"
4040
import ButtonLink from "../components/ButtonLink"
4141
import FeedbackCard from "../components/FeedbackCard"
4242
import Icon from "../components/Icon"
43-
import NakedButton from "../components/NakedButton"
4443

4544
// Utils
4645
import { translateMessageId, TranslationKey } from "../utils/translations"
@@ -319,14 +318,6 @@ const StyledEmoji = styled(Emoji)`
319318
margin-right: 1rem;
320319
`
321320

322-
const ScrollLink = styled(NakedButton)`
323-
text-align: start;
324-
color: ${({ theme }) => theme.colors.primary};
325-
&.active {
326-
color: ${({ theme }) => theme.colors.primary};
327-
}
328-
`
329-
330321
const BuildContainer = styled(Container)`
331322
flex: 1;
332323
padding: 2rem;
@@ -760,16 +751,14 @@ const RunANodePage = ({ data }: PageProps<Queries.RunANodePageQuery>) => {
760751
<Translation id="page-run-a-node-build-your-own-min-ram" />
761752
</p>
762753
<p>
763-
<ScrollLink
764-
onClick={() => scrollIntoView("plan-on-staking")}
765-
>
754+
<Link href="#plan-on-staking">
766755
<Translation id="page-run-a-node-build-your-own-ram-note-1" />
767-
</ScrollLink>
756+
</Link>
768757
</p>
769758
<p>
770-
<ScrollLink onClick={() => scrollIntoView("rasp-pi")}>
759+
<Link href="#rasp-pi">
771760
<Translation id="page-run-a-node-build-your-own-ram-note-2" />
772-
</ScrollLink>
761+
</Link>
773762
</p>
774763
</li>
775764
<li>

0 commit comments

Comments
 (0)