Skip to content

Commit a4618bf

Browse files
committed
Rename grid files
1 parent 24981ee commit a4618bf

File tree

6 files changed

+29
-18
lines changed

6 files changed

+29
-18
lines changed

components/ContextMenu/ContextMenu.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ import { styled, keyframes } from 'stitches.config';
22
import { createToast } from 'vercel-toast';
33
import * as RadixContextMenu from '@radix-ui/react-context-menu';
44

5+
const timeout = 3000;
6+
57
const ContextMenu = ({ children, stitchesStyling, cssStyling, scssStyling }) => {
68
const copyToClipboard = async (styling) => {
79
try {
810
await navigator.clipboard.writeText(styling);
911

1012
createToast('Copied styles to clipboard', {
11-
timeout: 3000
13+
timeout
1214
});
1315
} catch {
1416
createToast('Failed to copy', {
15-
timeout: 3000,
17+
timeout,
1618
type: 'error'
1719
});
1820
}

components/Grid/index.js

-1
This file was deleted.

components/LinkPreview/LinkPreview.js

+17-8
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import { styled } from 'stitches.config';
1010
const LinkPreview = ({ url, children }) => {
1111
const [isMounted, setIsMounted] = useState(false);
1212

13-
const width = 200;
14-
const height = 128;
15-
const quality = 50;
16-
const layout = 'fixed';
13+
const previewImage = {
14+
width: 200,
15+
height: 128,
16+
quality: 50,
17+
layout: 'fixed'
18+
};
1719

1820
const params = encode({
1921
url,
@@ -37,9 +39,9 @@ const LinkPreview = ({ url, children }) => {
3739
<Image
3840
alt={`Screenshot of ${url}`}
3941
src={screenshot}
40-
width={width}
41-
height={height}
42-
layout={layout}
42+
width={previewImage.width}
43+
height={previewImage.height}
44+
layout={previewImage.layout}
4345
priority={true}
4446
/>
4547
</Hidden>
@@ -49,7 +51,14 @@ const LinkPreview = ({ url, children }) => {
4951
{children}
5052
</HoverCardTrigger>
5153
<HoverCardContent side="top" sideOffset={5}>
52-
<StyledImage width={width} height={height} layout="fixed" quality={50} src={screenshot} />
54+
<StyledImage
55+
alt={`Screenshot of ${url}`}
56+
src={screenshot}
57+
width={previewImage.width}
58+
height={previewImage.height}
59+
layout={previewImage.layout}
60+
priority={true}
61+
/>
5362
</HoverCardContent>
5463
</HoverCard.Root>
5564
);

components/Grid/Grid.js renamed to components/SnippetsGrid/SnippetsGrid.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { styled } from 'stitches.config';
22

33
import snippets from 'components/Snippets';
4-
import GridItem from './components/GridItem';
54
import ContextMenu from 'components/ContextMenu';
5+
import SnippetsGridItem from './SnippetsGridItem';
66

7-
const Grid = ({ children }) => {
7+
const SnippetsGrid = ({ children }) => {
88
return (
99
<Wrapper>
1010
{snippets.map(({ Component, cssStyling, scssStyling, stitchesStyling }) => (
@@ -13,9 +13,9 @@ const Grid = ({ children }) => {
1313
scssStyling={scssStyling}
1414
stitchesStyling={stitchesStyling}
1515
key={stitchesStyling}>
16-
<GridItem>
16+
<SnippetsGridItem>
1717
<Component />
18-
</GridItem>
18+
</SnippetsGridItem>
1919
</ContextMenu>
2020
))}
2121
</Wrapper>
@@ -36,4 +36,4 @@ const Wrapper = styled('div', {
3636
}
3737
});
3838

39-
export default Grid;
39+
export default SnippetsGrid;

components/Grid/components/GridItem.js renamed to components/SnippetsGrid/SnippetsGridItem.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { styled } from 'stitches.config';
22

3-
const GridItem = ({ children, stitchesStyling }) => {
3+
const SnippetsGridItem = ({ children }) => {
44
return <Wrapper>{children}</Wrapper>;
55
};
66

@@ -13,4 +13,4 @@ const Wrapper = styled('div', {
1313
alignItems: 'center'
1414
});
1515

16-
export default GridItem;
16+
export default SnippetsGridItem;

components/SnippetsGrid/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './SnippetsGrid';

0 commit comments

Comments
 (0)