Skip to content

Commit

Permalink
feat: hooks + consistent stories
Browse files Browse the repository at this point in the history
  • Loading branch information
jagnani73 committed Dec 5, 2023
1 parent db62c55 commit 4d245d3
Show file tree
Hide file tree
Showing 32 changed files with 704 additions and 673 deletions.
11 changes: 8 additions & 3 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import "../src/tailwind-output.css";
import { themes } from "@storybook/theming";
import { CovalentProvider } from "../src/utils/store/Covalent";
import { ChainsProvider } from "../src/utils/store/Chains";
import {
CovalentProvider,
ChainsProvider,
ThemeProvider,
} from "../src/utils/store";
// import { useDarkMode } from 'storybook-dark-mode' // uncomment out this one line for dark mode

export const parameters = {
Expand Down Expand Up @@ -58,7 +61,9 @@ const preview: Preview = {
apikey={import.meta.env.STORYBOOK_COVALENT_API_KEY}
>
<ChainsProvider>
<Story />
<ThemeProvider theme={{}}>
<Story />
</ThemeProvider>
</ChainsProvider>
</CovalentProvider>
),
Expand Down
10 changes: 5 additions & 5 deletions src/components/Atoms/Address/Address.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { type Meta, type StoryObj } from "@storybook/react";
import { Address } from "./Address";
import { AddressView } from "./AddressView";

const meta: Meta<typeof Address> = {
const meta: Meta<typeof AddressView> = {
title: "Atoms/Address",
component: Address,
component: AddressView,
};

export default meta;

type Story = StoryObj<typeof Address>;
type Story = StoryObj<typeof AddressView>;

export const AddressDisplay: Story = {
export const Address: Story = {
args: {
address: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { copyToClipboard, truncate } from "@/utils/functions";
import { IconWrapper } from "@/components/Atoms/IconWrapper/IconWrapper";
import { IconWrapper } from "@/components/Shared";
import { type AddressProps } from "@/utils/types/atoms.types";

export const Address: React.FC<AddressProps> = ({ address }) => {
export const AddressView: React.FC<AddressProps> = ({ address }) => {
return (
<div className="flex items-center gap-x-2">
<p>{truncate(address)}</p>
Expand Down
98 changes: 48 additions & 50 deletions src/components/Atoms/AddressAvatar/AddressAvatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,65 +1,63 @@
import { type Meta, type StoryObj } from "@storybook/react";
import { AddressAvatar } from "./AddressAvatar";
import { AddressAvatarView } from "./AddressAvatarView";
import { type AddressAvatarProps } from "@/utils/types/atoms.types";
import { GRK_SIZES } from "@/utils/constants/shared.constants";

const meta: Meta<typeof AddressAvatar> = {
title: "Atoms/AddressAvatar",
component: AddressAvatar,
const meta: Meta<typeof AddressAvatarView> = {
title: "Atoms/Address Avatar",
component: AddressAvatarView,
};

export default meta;

type Story = StoryObj<typeof AddressAvatar>;
type Story = StoryObj<typeof AddressAvatarView>;

const render = ({ size, type, address, rounded }: AddressAvatarProps) => {
return (
<>
<div className="m-1">
<AddressAvatar
address={address}
size={size}
type={type}
rounded={rounded}
/>
</div>

<div className="m-1 mt-20 flex gap-1">
<AddressAvatar
address={address}
size={GRK_SIZES.LARGE}
type={"effigy"}
/>
<AddressAvatar
address={address}
size={GRK_SIZES.MEDIUM}
type={"wallet"}
/>
<AddressAvatar
address={address}
size={GRK_SIZES.SMALL}
type={"effigy"}
/>
<AddressAvatar
address={address}
size={GRK_SIZES.EXTRA_SMALL}
type={"fingerprint"}
/>
<AddressAvatar
address={address}
size={GRK_SIZES.EXTRA_EXTRA_SMALL}
type={"wallet"}
/>
</div>
</>
);
};

export const AvatarSizes: Story = {
export const AddressAvatar: Story = {
args: {
size: GRK_SIZES.SMALL,
type: "fingerprint",
address: "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
},
render: render,
render: ({ size, type, address, rounded }: AddressAvatarProps) => {
return (
<>
<div className="m-1">
<AddressAvatarView
address={address}
size={size}
type={type}
rounded={rounded}
/>
</div>

<div className="m-1 mt-20 flex gap-1">
<AddressAvatarView
address={address}
size={GRK_SIZES.LARGE}
type={"effigy"}
/>
<AddressAvatarView
address={address}
size={GRK_SIZES.MEDIUM}
type={"wallet"}
/>
<AddressAvatarView
address={address}
size={GRK_SIZES.SMALL}
type={"effigy"}
/>
<AddressAvatarView
address={address}
size={GRK_SIZES.EXTRA_SMALL}
type={"fingerprint"}
/>
<AddressAvatarView
address={address}
size={GRK_SIZES.EXTRA_EXTRA_SMALL}
type={"wallet"}
/>
</div>
</>
);
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
import { type AddressAvatarProps } from "@/utils/types/atoms.types";
import { useMemo } from "react";

export const AddressAvatar: React.FC<AddressAvatarProps> = ({
export const AddressAvatarView: React.FC<AddressAvatarProps> = ({
address,
type,
size,
Expand Down
34 changes: 0 additions & 34 deletions src/components/Atoms/NetPriceDelta/NetPriceDelta.tsx

This file was deleted.

Loading

0 comments on commit 4d245d3

Please sign in to comment.