Skip to content

Commit

Permalink
feat use library icons in stories
Browse files Browse the repository at this point in the history
  • Loading branch information
e-krebs committed Oct 15, 2023
1 parent 6ba287d commit ab738fc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .ladle/Icons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';

import { Icon, IconProps } from '../src/assets/Icons';

type Props = Omit<IconProps, 'id'>;

export const Minus = (props: Props) => <Icon id="minus" {...props} />;
export const Plus = (props: Props) => <Icon id="plus" {...props} />;
2 changes: 1 addition & 1 deletion src/Inputs/inputs-controlled.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useState } from 'react';
import { Minus, Plus } from 'react-feather';
import { Section } from 'utils';

import { Minus, Plus } from '../../.ladle/Icons';
import { Button } from '../Button';
import { TextInput } from './TextInput';

Expand Down
2 changes: 1 addition & 1 deletion src/Inputs/number-input-controlled.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useState } from 'react';
import { Minus, Plus } from 'react-feather';
import { Section } from 'utils';

import { Minus, Plus } from '../../.ladle/Icons';
import { Button } from '../Button';
import { NumberInput } from './NumberInput';

Expand Down
4 changes: 2 additions & 2 deletions src/Modal/modal.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRef, useState } from 'react';
import { X } from 'react-feather';

import { Icon } from '../assets/Icons';
import { Button } from '../Button';
import { Modal, type ModalRef } from './index';

Expand Down Expand Up @@ -41,7 +41,7 @@ export const ModalStory = () => {
</li>
<li>Clicking outside of the modal,</li>
<li>
Clicking the <X /> Button at the top-right of the modal,
Clicking the <Icon id="x" /> Button at the top-right of the modal,
</li>
<li>Clicking either button below.</li>
</ol>
Expand Down
2 changes: 1 addition & 1 deletion src/assets/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type SVGProps } from 'react';

const icons = ['minus', 'plus', 'check', 'chevron-down', 'x'] as const;

interface IconProps extends SVGProps<SVGSVGElement> {
export interface IconProps extends SVGProps<SVGSVGElement> {
id: (typeof icons)[number];
}

Expand Down

0 comments on commit ab738fc

Please sign in to comment.