Skip to content

Commit

Permalink
Adding test to ensure all icons are in a 20x20 viewBox and fixing ico…
Browse files Browse the repository at this point in the history
…ns which didnt match
  • Loading branch information
corbanbrook committed Jan 9, 2025
1 parent 1e9c595 commit 3be4388
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion public/static/icons/HomeIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions public/static/icons/WalletConnectIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/icons/HomeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Svg = (props: SVGProps<SVGSVGElement>) => (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 21 20"
viewBox="0 0 20 20"
{...props}
>
<path
Expand Down
14 changes: 14 additions & 0 deletions src/icons/Icon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { cleanup, render } from '@testing-library/react'

import ScanIcon from './ScanIcon'

import * as icons from './index'

describe('Icons', () => {
afterEach(cleanup)

Expand All @@ -11,4 +13,16 @@ describe('Icons', () => {

expect(el?.getAttribute('viewBox')).toBe('0 0 20 20')
})

it('have a 20x20 viewBox', () => {
for (const [key, Icon] of Object.entries(icons)) {
const { container } = render(<Icon />)
const el = container.querySelector('svg')

expect(
el?.getAttribute('viewBox'),
`${key} does not have a 20x20 viewBox`
).toBe('0 0 20 20')
}
})
})
4 changes: 2 additions & 2 deletions src/icons/WalletConnectIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const Svg = (props: SVGProps<SVGSVGElement>) => (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 480 332"
viewBox="0 0 20 20"
{...props}
>
<path
fill="currentColor"
d="M126.613 93.984c62.622-61.312 164.152-61.312 226.775 0l7.536 7.379a7.735 7.735 0 0 1 0 11.102l-25.781 25.242a4.07 4.07 0 0 1-5.67 0l-10.371-10.154c-43.687-42.773-114.517-42.773-158.204 0l-11.107 10.874a4.069 4.069 0 0 1-5.669 0l-25.781-25.242a7.733 7.733 0 0 1 0-11.102zm280.093 52.204 22.946 22.465a7.735 7.735 0 0 1 0 11.102L326.189 281.056c-3.131 3.065-8.208 3.065-11.339 0l-73.432-71.896a2.034 2.034 0 0 0-2.835 0l-73.43 71.896c-3.131 3.065-8.208 3.065-11.339 0L50.348 179.754a7.735 7.735 0 0 1 0-11.102l22.946-22.466c3.131-3.065 8.208-3.065 11.339 0l73.433 71.897a2.033 2.033 0 0 0 2.834 0l73.429-71.897c3.131-3.065 8.208-3.065 11.339 0l73.433 71.897a2.034 2.034 0 0 0 2.835 0l73.431-71.895c3.132-3.066 8.208-3.066 11.339 0z"
d="M14.725 6.94c-2.61-2.586-6.84-2.586-9.45 0l-.314.31a.329.329 0 0 0 0 .468l1.075 1.065a.168.168 0 0 0 .236 0l.432-.428a4.691 4.691 0 0 1 6.592 0l.463.458a.168.168 0 0 0 .236 0l1.074-1.064a.329.329 0 0 0 0-.468l-.345-.342ZM3.054 9.14l-.956.948a.329.329 0 0 0 0 .468l4.31 4.272c.131.129.343.129.473 0l3.06-3.032a.084.084 0 0 1 .118 0l3.06 3.032c.13.129.342.129.472 0l4.311-4.272a.33.33 0 0 0 0-.468l-.956-.948a.336.336 0 0 0-.472 0l-3.06 3.032a.084.084 0 0 1-.118 0l-3.06-3.032a.336.336 0 0 0-.472 0l-3.06 3.032a.084.084 0 0 1-.118 0L3.526 9.14a.336.336 0 0 0-.472 0Z"
/>
</svg>
)
Expand Down

0 comments on commit 3be4388

Please sign in to comment.