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

SOV-3333: update vertical tabs style #657

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
23 changes: 19 additions & 4 deletions packages/ui/src/2_molecules/VerticalTabs/VerticalTabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Story } from '@storybook/react';

import { ComponentProps, useCallback, useReducer, useState } from 'react';

import { Button, Heading } from '../../1_atoms';
import { Button, Heading, Icon, IconNames } from '../../1_atoms';
import { Dialog } from '../Dialog/Dialog';
import { DialogSize } from '../Dialog/Dialog.types';
import { VerticalTabs } from './VerticalTabs';
Expand Down Expand Up @@ -60,9 +60,18 @@ const DialogTemplate: Story<ComponentProps<typeof VerticalTabs>> = args => {
export const Basic = Template.bind({});
Basic.args = {
items: [
{ label: 'Tab 1', content: 'Tab 1 Content' },
{ label: 'Tab 2', content: 'Tab 2 Content' },
{ label: 'Tab 3', content: 'Tab 3 Content' },
{
label: 'Tab 1',
content: 'Tab 1 Content',
},
{
label: 'Tab 2',
content: 'Tab 2 Content',
},
{
label: 'Tab 3',
content: 'Tab 3 Content',
},
{
label: 'Tab4 ',
infoText: 'Example with long content',
Expand All @@ -76,6 +85,12 @@ Basic.args = {
</ol>
</div>
),
icon: <Icon className="text-sovryn-blue" icon={IconNames.CHECK} />,
},
{
label: 'No account',
content: <div>No account</div>,
className: 'ml-[3.75rem]',
},
],
selectedIndex: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export type VerticalTabsItem = {
infoText?: ReactNode;
disabled?: boolean;
dataAttribute?: string;
icon?: ReactNode;
className?: string;
};

export type VerticalTabsItemButtonProps = VerticalTabsItem & {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
.button {
@apply w-full block text-left text-gray-10 text-opacity-50 font-medium bg-transparent;
@apply w-full block text-left text-gray-10 transition-opacity opacity-50 font-medium bg-transparent flex items-center gap-3;

&.active, &:hover {
@apply text-opacity-100;
&.active,
&:hover {
@apply opacity-100;
}

& .info {
@apply block mt-2;
}

& .icon {
@apply flex items-center justify-center w-12 h-12 rounded bg-gray-70;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const VerticalTabItem: FC<VerticalTabsItemButtonProps> = ({
active,
dataAttribute,
onClick,
icon,
className,
}) => {
return (
<button
Expand All @@ -23,8 +25,11 @@ export const VerticalTabItem: FC<VerticalTabsItemButtonProps> = ({
data-active={active}
onClick={onClick}
>
<Heading type={HeadingType.h2}>{label}</Heading>
{infoText && <Paragraph className={styles.info}>{infoText}</Paragraph>}
{icon && <span className={styles.icon}> {icon} </span>}
<div className={className}>
<Heading type={HeadingType.h2}>{label}</Heading>
{infoText && <Paragraph className={styles.info}>{infoText}</Paragraph>}
</div>
</button>
);
};