-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wallet-ext: button connected to component
* implement figma button component to reuse in dapp status and (later) for account selector
- Loading branch information
1 parent
83ab847
commit b16eaaa
Showing
6 changed files
with
105 additions
and
76 deletions.
There are no files selected for viewing
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
31 changes: 31 additions & 0 deletions
31
apps/wallet/src/ui/app/shared/button-connected-to/ButtonConnectedTo.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,31 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { type Meta, type StoryObj } from '@storybook/react'; | ||
|
||
import { ButtonConnectedTo } from './'; | ||
|
||
export default { | ||
component: ButtonConnectedTo, | ||
} as Meta<typeof ButtonConnectedTo>; | ||
|
||
export const Default: StoryObj<typeof ButtonConnectedTo> = { | ||
args: { | ||
text: 'Button', | ||
}, | ||
}; | ||
|
||
export const LightGrey: StoryObj<typeof ButtonConnectedTo> = { | ||
args: { | ||
text: 'Button', | ||
bgOnHover: 'grey', | ||
}, | ||
}; | ||
|
||
export const Disabled: StoryObj<typeof ButtonConnectedTo> = { | ||
args: { | ||
text: 'Button', | ||
bgOnHover: 'grey', | ||
disabled: true, | ||
}, | ||
}; |
51 changes: 51 additions & 0 deletions
51
apps/wallet/src/ui/app/shared/button-connected-to/index.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,51 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import { cva, type VariantProps } from 'class-variance-authority'; | ||
import { type ComponentProps, forwardRef, type ReactNode } from 'react'; | ||
|
||
const styles = cva( | ||
[ | ||
'cursor-pointer outline-0 flex flex-row items-center py-1 px-2 gap-1 rounded-2xl', | ||
'transition text-body-small font-medium border border-solid', | ||
'border-transparent bg-transparent', | ||
'hover:text-hero hover:bg-sui-light hover:border-sui', | ||
'focus:text-hero focus:bg-sui-light focus:border-sui', | ||
'active:text-steel active:bg-gray-45 active:border-transparent', | ||
'disabled:text-gray-60 disabled:bg-transparent disabled:border-transparent', | ||
], | ||
{ | ||
variants: { | ||
bgOnHover: { | ||
blueLight: ['text-hero'], | ||
grey: ['text-steel-dark'], | ||
}, | ||
}, | ||
defaultVariants: { | ||
bgOnHover: 'blueLight', | ||
}, | ||
} | ||
); | ||
|
||
export interface ButtonConnectedToProps | ||
extends VariantProps<typeof styles>, | ||
Omit<ComponentProps<'button'>, 'ref' | 'className'> { | ||
iconLeft?: ReactNode; | ||
text?: string; | ||
iconRight?: ReactNode; | ||
} | ||
|
||
export const ButtonConnectedTo = forwardRef< | ||
HTMLButtonElement, | ||
ButtonConnectedToProps | ||
>(({ bgOnHover, iconLeft, iconRight, text, ...rest }, ref) => { | ||
return ( | ||
<button {...rest} ref={ref} className={styles({ bgOnHover })}> | ||
{iconLeft} | ||
{text} | ||
{iconRight} | ||
</button> | ||
); | ||
}); | ||
|
||
ButtonConnectedTo.displayName = 'ButtonConnectedTo'; |
49 changes: 1 addition & 48 deletions
49
apps/wallet/src/ui/app/shared/dapp-status/DappStatus.module.scss
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.