Skip to content

Commit d4297c2

Browse files
evanyan13Evan Yan
andauthored
Convert svgs to tsx (#135)
Co-authored-by: Evan Yan <evan.yan@constructor.io>
1 parent a9c6d52 commit d4297c2

File tree

7 files changed

+53
-14
lines changed

7 files changed

+53
-14
lines changed

src/components/Breadcrumbs/BreadcrumbElement.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { concatStyles } from '../../utils/styleHelpers';
33
import { BreadcrumbProps } from './types';
4-
import ChevronRight from '../../icons/chevron-right.svg';
4+
import ChevronRightIcon from './ChevronRightIcon';
55

66
export default function BreadcrumbElement({
77
path,
@@ -22,7 +22,7 @@ export default function BreadcrumbElement({
2222
)}>
2323
{!isCurrentPage ? <a href={path}>{breadcrumb}</a> : <span>{breadcrumb}</span>}
2424
</li>
25-
{!isCurrentPage && <img src={ChevronRight} alt='chevron-right' />}
25+
{!isCurrentPage && <ChevronRightIcon />}
2626
</>
2727
);
2828
}

src/components/Breadcrumbs/Breadcrumbs.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
padding: 8px;
55
margin: 0;
66
gap: 4px;
7+
justify-content: center;
8+
align-items: center;
79
}
810

911
.cio-plp-breadcrumb {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import * as React from 'react';
2+
import { SVGProps } from 'react';
3+
4+
function ChevronRightIcon(props: SVGProps<SVGSVGElement>) {
5+
return (
6+
<svg
7+
width={8}
8+
height={8}
9+
viewBox='0 0 8 8'
10+
fill='none'
11+
xmlns='http://www.w3.org/2000/svg'
12+
{...props}>
13+
<path
14+
d='m3.033.85 2.993 2.993a.223.223 0 0 1 0 .315L3.034 7.15'
15+
stroke='#000'
16+
strokeOpacity={0.3}
17+
strokeWidth={1.2}
18+
strokeLinecap='round'
19+
strokeLinejoin='round'
20+
/>
21+
</svg>
22+
);
23+
}
24+
25+
export default ChevronRightIcon;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as React from 'react';
2+
import { SVGProps } from 'react';
3+
4+
function EllipsisIcon(props: SVGProps<SVGSVGElement>) {
5+
return (
6+
<svg
7+
width={14}
8+
height={4}
9+
viewBox='0 0 14 4'
10+
fill='none'
11+
xmlns='http://www.w3.org/2000/svg'
12+
{...props}>
13+
<circle cx={1.5} cy={2} r={1.5} fill='#000' fillOpacity={0.8} />
14+
<circle cx={7} cy={2} r={1.5} fill='#000' fillOpacity={0.8} />
15+
<circle cx={12.5} cy={2} r={1.5} fill='#000' fillOpacity={0.8} />
16+
</svg>
17+
);
18+
}
19+
20+
export default EllipsisIcon;

src/components/Breadcrumbs/MoreBreadcrumbsMenu.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { MoreBreadcrumbsMenuProps } from './types';
3-
import Ellipsis from '../../icons/ellipsis.svg';
4-
import ChevronRight from '../../icons/chevron-right.svg';
3+
import ChevronRightIcon from './ChevronRightIcon';
4+
import EllipsisIcon from './EllipsisIcon';
55

66
export default function MoreBreadcrumbsMenu({ breadcrumbs }: MoreBreadcrumbsMenuProps) {
77
const [expanded, setExpanded] = React.useState(false);
@@ -39,7 +39,7 @@ export default function MoreBreadcrumbsMenu({ breadcrumbs }: MoreBreadcrumbsMenu
3939
onClick={() => {
4040
setExpanded(!expanded);
4141
}}>
42-
<img src={Ellipsis} alt='more menu icon' />
42+
<EllipsisIcon />
4343
</button>
4444
<nav
4545
id='cio-more-menu'
@@ -59,7 +59,7 @@ export default function MoreBreadcrumbsMenu({ breadcrumbs }: MoreBreadcrumbsMenu
5959
)}
6060
</nav>
6161
</li>
62-
<img src={ChevronRight} alt='chevron-right' />
62+
<ChevronRightIcon />
6363
</>
6464
);
6565
}

src/icons/chevron-right.svg

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

src/icons/ellipsis.svg

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

0 commit comments

Comments
 (0)