[T-4862: feat] Link component (#88)

This commit is contained in:
Wahyu Kurniawan 2024-02-22 09:17:22 +07:00 committed by GitHub
parent ea44efa0f2
commit eb6a727425
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 54 additions and 1 deletions

View File

@ -118,6 +118,29 @@ export const buttonTheme = tv(
'disabled:border-transparent',
'disabled:shadow-none',
],
link: [
'p-0',
'gap-1.5',
'text-elements-link',
'rounded',
'focus-ring',
'hover:underline',
'hover:text-elements-link-hovered',
'disabled:text-controls-disabled',
'disabled:hover:no-underline',
],
'link-emphasized': [
'p-0',
'gap-1.5',
'text-elements-high-em',
'rounded',
'underline',
'focus-ring',
'hover:text-elements-link-hovered',
'disabled:text-controls-disabled',
'disabled:hover:no-underline',
'dark:text-elements-on-high-contrast',
],
unstyled: [],
},
},

View File

@ -7,7 +7,11 @@ import {
} from './renders/checkbox';
import { avatars, avatarsFallback } from './renders/avatar';
import { renderBadges } from './renders/badge';
import { renderButtonIcons, renderButtons } from './renders/button';
import {
renderButtonIcons,
renderButtons,
renderLinks,
} from './renders/button';
import {
renderTabWithBadges,
renderTabs,
@ -112,6 +116,16 @@ const Page = () => {
<h1 className="text-2xl font-bold">Vertical Tabs</h1>
{renderVerticalTabs()}
</div>
<div className="w-full h border border-gray-200 px-20 my-10" />
{/* Link */}
<div className="flex flex-col gap-10 items-center justify-between">
<h1 className="text-2xl font-bold">Link</h1>
<div className="flex gap-4 items-center justify-center">
{renderLinks()}
</div>
</div>
</div>
</div>
</div>

View File

@ -47,3 +47,19 @@ export const renderButtonIcons = () => {
</div>
));
};
export const renderLinks = () => {
return ['link', 'link-emphasized', 'disabled'].map((variant) => (
<Button
variant={
variant !== 'disabled' ? (variant as ButtonTheme['variant']) : 'link'
}
key={variant}
leftIcon={<PlusIcon />}
rightIcon={<PlusIcon />}
disabled={variant === 'disabled'}
>
Link
</Button>
));
};