Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a68b076

Browse files
authored
refactor: Rename Icons and add stories (#1080)
* Rename CloseIcon * Rename FileCopyIcon, take out of index * Rename LogoutIcon and remove from index * Delete icons index files * Add icon stories * Lint
1 parent b9933d4 commit a68b076

20 files changed

+137
-33
lines changed

site/src/components/Button/CopyButton.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { makeStyles } from "@material-ui/core/styles"
33
import Tooltip from "@material-ui/core/Tooltip"
44
import Check from "@material-ui/icons/Check"
55
import React, { useState } from "react"
6-
import { FileCopy } from "../Icons"
6+
import { FileCopyIcon } from "../Icons/FileCopyIcon"
77

88
interface CopyButtonProps {
99
text: string
@@ -38,7 +38,7 @@ export const CopyButton: React.FC<CopyButtonProps> = ({ className = "", text })
3838
<Tooltip title="Copy to Clipboard" placement="top">
3939
<div className={`${styles.copyButtonWrapper} ${className}`}>
4040
<Button className={styles.copyButton} onClick={copyToClipboard} size="small">
41-
{isCopied ? <Check className={styles.fileCopyIcon} /> : <FileCopy className={styles.fileCopyIcon} />}
41+
{isCopied ? <Check className={styles.fileCopyIcon} /> : <FileCopyIcon className={styles.fileCopyIcon} />}
4242
</Button>
4343
</div>
4444
</Tooltip>

site/src/components/Form/FormCloseButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import IconButton from "@material-ui/core/IconButton"
22
import { makeStyles } from "@material-ui/core/styles"
33
import Typography from "@material-ui/core/Typography"
44
import React, { useEffect } from "react"
5-
import { CloseIcon } from "../Icons/Close"
5+
import { CloseIcon } from "../Icons/CloseIcon"
66

77
export interface FormCloseButtonProps {
88
onClose: () => void
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { BuildingIcon } from "./BuildingIcon"
4+
5+
export default {
6+
title: "icons/BuildingIcon",
7+
component: BuildingIcon,
8+
}
9+
10+
const Template: Story = (args) => <BuildingIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { CloseIcon } from "./CloseIcon"
4+
5+
export default {
6+
title: "icons/CloseIcon",
7+
component: CloseIcon,
8+
}
9+
10+
const Template: Story = (args) => <CloseIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { CoderIcon } from "./CoderIcon"
4+
5+
export default {
6+
title: "icons/CoderIcon",
7+
component: CoderIcon,
8+
}
9+
10+
const Template: Story = (args) => <CoderIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { DocsIcon } from "./DocsIcon"
4+
5+
export default {
6+
title: "icons/DocsIcon",
7+
component: DocsIcon,
8+
}
9+
10+
const Template: Story = (args) => <DocsIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { ErrorIcon } from "./ErrorIcon"
4+
5+
export default {
6+
title: "icons/ErrorIcon",
7+
component: ErrorIcon,
8+
}
9+
10+
const Template: Story = (args) => <ErrorIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { FileCopyIcon } from "./FileCopyIcon"
4+
5+
export default {
6+
title: "icons/FileCopyIcon",
7+
component: FileCopyIcon,
8+
}
9+
10+
const Template: Story = (args) => <FileCopyIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}

site/src/components/Icons/FileCopy.tsx renamed to site/src/components/Icons/FileCopyIcon.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import SvgIcon from "@material-ui/core/SvgIcon"
22
import React from "react"
33

4-
export const FileCopy: typeof SvgIcon = (props) => (
4+
export const FileCopyIcon: typeof SvgIcon = (props) => (
55
<SvgIcon {...props} viewBox="0 0 20 20">
66
<path
77
d="M12.7412 2.2807H4.32014C3.5447 2.2807 2.91663 2.90877 2.91663 3.68421V13.5088H4.32014V3.68421H12.7412V2.2807ZM14.8465 5.08772H7.12716C6.35172 5.08772 5.72365 5.71579 5.72365 6.49123V16.3158C5.72365 17.0912 6.35172 17.7193 7.12716 17.7193H14.8465C15.6219 17.7193 16.25 17.0912 16.25 16.3158V6.49123C16.25 5.71579 15.6219 5.08772 14.8465 5.08772ZM14.8465 16.3158H7.12716V6.49123H14.8465V16.3158Z"
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { Logo } from "./Logo"
4+
5+
export default {
6+
title: "icons/Logo",
7+
component: Logo,
8+
}
9+
10+
const Template: Story = (args) => <Logo fill="black" {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { LogoutIcon } from "./LogoutIcon"
4+
5+
export default {
6+
title: "icons/LogoutIcon",
7+
component: LogoutIcon,
8+
}
9+
10+
const Template: Story = (args) => <LogoutIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { UsersOutlinedIcon } from "./UsersOutlinedIcon"
4+
5+
export default {
6+
title: "icons/UsersOutlinedIcon",
7+
component: UsersOutlinedIcon,
8+
}
9+
10+
const Template: Story = (args) => <UsersOutlinedIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Story } from "@storybook/react"
2+
import React from "react"
3+
import { WorkspacesIcon } from "./WorkspacesIcon"
4+
5+
export default {
6+
title: "icons/WorkspacesIcon",
7+
component: WorkspacesIcon,
8+
}
9+
10+
const Template: Story = (args) => <WorkspacesIcon {...args} />
11+
12+
export const Example = Template.bind({})
13+
Example.args = {}

site/src/components/Icons/index.test.tsx

-21
This file was deleted.

site/src/components/Icons/index.ts

-5
This file was deleted.

site/src/components/Navbar/NavbarView/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { NavLink } from "react-router-dom"
66
import { UserResponse } from "../../../api/types"
77
import { navHeight } from "../../../theme/constants"
88
import { AdminDropdown } from "../../AdminDropdown/AdminDropdown"
9-
import { Logo } from "../../Icons"
9+
import { Logo } from "../../Icons/Logo"
1010
import { UserDropdown } from "../UserDropdown"
1111

1212
export interface NavbarViewProps {

site/src/components/Navbar/UserDropdown/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { Link } from "react-router-dom"
1010
import { UserResponse } from "../../../api/types"
1111
import { BorderedMenu } from "../../BorderedMenu/BorderedMenu"
1212
import { CloseDropdown, OpenDropdown } from "../../DropdownArrows/DropdownArrows"
13-
import { LogoutIcon } from "../../Icons"
1413
import { DocsIcon } from "../../Icons/DocsIcon"
14+
import { LogoutIcon } from "../../Icons/LogoutIcon"
1515
import { UserAvatar } from "../../User"
1616
import { UserProfileCard } from "../../User/UserProfileCard"
1717

site/src/components/SignIn/Welcome.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import Typography from "@material-ui/core/Typography"
33
import React from "react"
4-
import { CoderIcon } from "../Icons"
4+
import { CoderIcon } from "../Icons/CoderIcon"
55

66
export const Welcome: React.FC = () => {
77
const styles = useStyles()

0 commit comments

Comments
 (0)