diff --git a/libs/ui-toolkit/src/components/index.ts b/libs/ui-toolkit/src/components/index.ts index 38e0c8b64..4c4ee984d 100644 --- a/libs/ui-toolkit/src/components/index.ts +++ b/libs/ui-toolkit/src/components/index.ts @@ -54,3 +54,4 @@ export * from './traffic-light'; export * from './vega-icons'; export * from './vega-logo'; export * from './viewing-as-user'; +export * from './pill'; diff --git a/libs/ui-toolkit/src/components/pill/index.ts b/libs/ui-toolkit/src/components/pill/index.ts new file mode 100644 index 000000000..ecc4c9e91 --- /dev/null +++ b/libs/ui-toolkit/src/components/pill/index.ts @@ -0,0 +1 @@ +export * from './pill'; diff --git a/libs/ui-toolkit/src/components/pill/pill.stories.tsx b/libs/ui-toolkit/src/components/pill/pill.stories.tsx new file mode 100644 index 000000000..5cd8b7d0a --- /dev/null +++ b/libs/ui-toolkit/src/components/pill/pill.stories.tsx @@ -0,0 +1,48 @@ +import type { Story, Meta } from '@storybook/react'; +import { Pill } from './pill'; +import { Intent } from '../../utils/intent'; + +export default { + component: Pill, + title: 'Pill', +} as Meta; + +const Template: Story = (args) => Pill; + +export const Default = Template.bind({ intent: Intent.Primary, size: 'md' }); + +export const None = Template.bind({}); +None.args = { + intent: Intent.None, + size: 'md', +}; + +export const Info = Template.bind({}); +Info.args = { + intent: Intent.Info, + size: 'md', +}; + +export const Primary = Template.bind({}); +Primary.args = { + intent: Intent.Primary, + size: 'md', +}; + +export const Success = Template.bind({}); +Success.args = { + intent: Intent.Success, + size: 'md', +}; + +export const Warning = Template.bind({}); +Warning.args = { + intent: Intent.Warning, + size: 'md', +}; + +export const Danger = Template.bind({}); +Danger.args = { + intent: Intent.Danger, + size: 'md', +}; diff --git a/libs/ui-toolkit/src/components/pill/pill.tsx b/libs/ui-toolkit/src/components/pill/pill.tsx new file mode 100644 index 000000000..aaf2d2477 --- /dev/null +++ b/libs/ui-toolkit/src/components/pill/pill.tsx @@ -0,0 +1,44 @@ +import type { ReactNode } from 'react'; +import { Intent } from '../../utils/intent'; +import classNames from 'classnames'; + +type Size = 'lg' | 'md' | 'sm' | 'xs' | 'xxs'; +interface Props { + children: ReactNode; + intent?: Intent; + size?: Size; + className?: string; +} + +const getClasses = (intent?: Intent, size: Size, className?: string) => { + return classNames( + ['rounded-md', 'leading-none', 'font-alpha', 'py-1 px-2'], + { + 'bg-vega-yellow dark:bg-vega-yellow': intent === Intent.Primary, + 'bg-vega-clight-500 dark:bg-vega-cdark-500': intent === Intent.None, + 'bg-vega-blue-500 dark:bg-vega-blue-500': intent === Intent.Info, + 'bg-vega-orange-350 dark:bg-vega-orange-650': intent === Intent.Warning, + 'bg-vega-red-350 dark:bg-vega-red-650': intent === Intent.Danger, + 'bg-vega-green-350 dark:bg-vega-green-650': intent === Intent.Success, + 'text-vega-clight-50 dark:text-vega-cdark-50': intent !== Intent.Primary, + 'text-vega-clight-900 dark:text-vega-cdark-900': + intent === Intent.Primary, + }, + { + 'text-lg': size === 'lg', + 'text-base': size === 'md', + 'text-sma': size === 'sm', + 'text-xs': size === 'xs', + 'text-[10px]': size === 'xxs', + }, + className + ); +}; + +export const Pill = ({ intent, size, className, children }: Props) => { + return ( + + {children} + + ); +}; diff --git a/libs/wallet/src/connect-dialog/connect-dialog.tsx b/libs/wallet/src/connect-dialog/connect-dialog.tsx index 20d4a6335..e58765fa2 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog.tsx @@ -5,7 +5,7 @@ import { FormGroup, Input, Intent, - Lozenge, + Pill, TradingButton, VegaIcon, VegaIconNames, @@ -24,10 +24,10 @@ import { JsonRpcConnectorForm } from './json-rpc-connector-form'; import { ViewConnectorForm } from './view-connector-form'; import { useEnvironment } from '@vegaprotocol/environment'; import { + BrowserIcon, ConnectDialogContent, ConnectDialogFooter, ConnectDialogTitle, - BrowserIcon, } from './connect-dialog-elements'; import type { Status as JsonRpcStatus } from '../use-json-rpc-connect'; import { useJsonRpcConnect } from '../use-json-rpc-connect'; @@ -337,9 +337,9 @@ const GetWallet = () => { <>
{t('Get the Vega Wallet')} - + ALPHA - +