Skip to content

Commit

Permalink
feat(icons): export sandpack icons (#288)
Browse files Browse the repository at this point in the history
* feat(icons): export sandpack icons

* docs: add story to the icons
  • Loading branch information
danilowoz authored Jan 11, 2022
1 parent 4227295 commit ec184f7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
14 changes: 14 additions & 0 deletions sandpack-react/src/icons/Icons.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { storiesOf } from "@storybook/react";
import React from "react";

import * as icons from ".";

const stories = storiesOf("Components/Icons", module);

Object.keys(icons).forEach((iconName) =>
stories.add(iconName, () => {
const Component = icons[iconName];

return <Component />;
})
);
10 changes: 6 additions & 4 deletions sandpack-react/src/icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export const CSBIcon = (): React.ReactElement => (
</svg>
);

export const DirectoryIcon = (props: {
export const DirectoryIcon = ({
isOpen = false,
}: {
isOpen?: boolean;
}): React.ReactElement => (
<svg
Expand All @@ -101,16 +103,16 @@ export const DirectoryIcon = (props: {
width="20"
xmlns="http://www.w3.org/2000/svg"
>
{props.isOpen ? (
{isOpen ? (
<path
d="M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2c-1.5-1.4-3.5-2.2-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32z m-180 0H238c-13 0-24.8 7.9-29.7 20L136 643.2V256h188.5l119.6 114.4H748V444z"
fill="currentColor"
></path>
/>
) : (
<path
d="M880 298.4H521L403.7 186.2c-1.5-1.4-3.5-2.2-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32z"
fill="currentColor"
></path>
/>
)}
</svg>
);
Expand Down
1 change: 1 addition & 0 deletions sandpack-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export * from "./contexts/sandpackContext";
export * from "./contexts/themeContext";
export * from "./themes";
export * from "./types";
export * from "./icons";

export * from "@code-hike/classer";

0 comments on commit ec184f7

Please sign in to comment.