Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update Wallet disconnect SVG #1103

Merged
merged 14 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/many-ways-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@coinbase/onchainkit": patch
---

chore: Update disconnect SVG image. By @cpcramer #1103
23 changes: 23 additions & 0 deletions src/internal/svg/disconnectSvg.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { Meta, StoryObj } from '@storybook/react';
import React from 'react';
import { disconnectSvg } from './disconnectSvg';

const SvgWrapper: React.FC = () =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

React.createElement(
'div',
{
style: { width: '100%', height: '100%', viewBox: '0 0 16 20' },
},
disconnectSvg,
);

const meta = {
title: 'Wallet/DisconnectSvg',
component: SvgWrapper,
tags: ['autodocs'],
} satisfies Meta<typeof SvgWrapper>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Basic: Story = {};
8 changes: 4 additions & 4 deletions src/internal/svg/disconnectSvg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { fill } from '../../styles/theme';
export const disconnectSvg = (
<svg
role="img"
aria-label="ock-disconnectSvg"
aria-label="ock-disconnect-svg"
width="100%"
height="100%"
viewBox="0 0 20 20"
viewBox="0 0 16 20"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a story for this component on Storybook?

Copy link
Contributor Author

@cpcramer cpcramer Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we do not have a storybook for any of our internal SVGs or our Wallet Components. Should I try to make one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a Fix Storybook task on Linear but it's getting deprioritized for tasks such as fix landing page and the upcoming Swap Component changes https://linear.app/coinbase/issue/BOE-313/fix-storybook

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment was more about. Go make a storybook page for every component you touch :)

So in this case you touch this component, let's have a story for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL you can add a story for an SVG! Added!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious why you updated this to 16 here ? are the other SVGs the same dimensions ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewBox 0 0 16 20 was specified in this new Svg - when downloading the image and displaying the code.

The image is off center when using 0 0 20 20.

fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M10.9735 2.69696L10.9735 4.52272L5.49622 4.52272L5.49622 15.4773L10.9735 15.4773L10.9735 17.303L3.67046 17.303L3.67046 2.69696L10.9735 2.69696Z"
d="M11.0668 0.91803L11.0668 2.93852L2.02049 2.93852L2.02049 15.0615L11.0668 15.0615L11.0668 17.082L-7.06549e-07 17.082L0 0.918029L11.0668 0.91803Z"
className={fill.defaultReverse}
/>
<path
d="M13.4614 13.5207L16.7804 10.0235L13.4783 6.34848L12.1202 7.56872L13.4931 9.09667L7.32216 9.09667L7.32216 10.9224L13.4102 10.9224L12.1371 12.2639L13.4614 13.5207Z"
d="M12.3273 12.8963L16.0002 9.02606L12.346 4.95902L10.843 6.30941L12.3623 8.00032L5.53321 8.00032L5.53321 10.0208L12.2706 10.0208L10.8617 11.5054L12.3273 12.8963Z"
className={fill.defaultReverse}
/>
</svg>
Expand Down
33 changes: 33 additions & 0 deletions src/wallet/components/WalletDropdownDisconnect.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { baseSepolia } from 'viem/chains';
import { http, WagmiProvider, createConfig } from 'wagmi';
import { WalletDropdownDisconnect } from './WalletDropdownDisconnect';

const wagmiConfig = createConfig({
chains: [baseSepolia],
transports: {
[baseSepolia.id]: http(),
},
});

export default {
title: 'Wallet/WalletDropdownDisconnect',
component: WalletDropdownDisconnect,
decorators: [
(Story) => (
<WagmiProvider config={wagmiConfig}>
<QueryClientProvider client={new QueryClient()}>
<Story />
</QueryClientProvider>
</WagmiProvider>
),
],
};

export const Default = () => <WalletDropdownDisconnect />;

export const CustomText = () => <WalletDropdownDisconnect text="Log Out" />;

export const CustomClass = () => (
<WalletDropdownDisconnect className="bg-red-500" />
);