-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
79 additions
and
20 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/app/components/address-displayer/form-address-displayer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/app/ui/components/address-displayer/address-displayer.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Flex } from 'leather-styles/jsx'; | ||
|
||
import { BtcAvatarIcon } from '../avatar/btc-avatar-icon'; | ||
import { StxAvatarIcon } from '../avatar/stx-avatar-icon'; | ||
import { Flag } from '../flag/flag'; | ||
import { AddressDisplayer as Component } from './address-displayer'; | ||
|
||
const meta: Meta<typeof Component> = { | ||
component: Component, | ||
tags: ['autodocs'], | ||
title: 'AddressDisplayer', | ||
parameters: { | ||
controls: { include: ['address'] }, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Component>; | ||
|
||
export const Bitcoin: Story = { | ||
args: { | ||
address: 'bc1pmzfrwwndsqmk5yh69yjr5lfgfg4ev8c0tsc06e', | ||
}, | ||
}; | ||
|
||
export const Stacks: Story = { | ||
args: { | ||
address: 'SP3XKZE32KZ925AAAGWPG1W66YP5BM2RD73T6AJHS', | ||
}, | ||
}; | ||
|
||
export const WithBTCIcon: Story = { | ||
args: { | ||
address: 'bc1pmzfrwwndsqmk5yh69yjr5lfgfg4ev8c0tsc06e', | ||
}, | ||
render: args => ( | ||
<Flag img={<BtcAvatarIcon />}> | ||
<Flex flexWrap="wrap" maxWidth="400px"> | ||
<Component address={args.address} /> | ||
</Flex> | ||
</Flag> | ||
), | ||
}; | ||
|
||
export const WithSTXIcon: Story = { | ||
args: { | ||
address: 'SP3XKZE32KZ925AAAGWPG1W66YP5BM2RD73T6AJHS', | ||
}, | ||
render: args => ( | ||
<Flag img={<StxAvatarIcon />}> | ||
<Flex flexWrap="wrap" maxWidth="400px"> | ||
<Component address={args.address} /> | ||
</Flex> | ||
</Flag> | ||
), | ||
}; |
19 changes: 6 additions & 13 deletions
19
...s/address-displayer/address-displayer.tsx → ...s/address-displayer/address-displayer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/app/ui/components/address-displayer/address-displayer.utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function groupByFour(text: string) { | ||
const result = []; | ||
for (let i = 0; i < text.length; i += 4) { | ||
result.push(text.slice(i, i + 4)); | ||
} | ||
return result; | ||
} |