-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style refactor and avatar component chages
- Loading branch information
Showing
9 changed files
with
175 additions
and
37 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
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,87 @@ | ||
import { BoAvatar, BoAvatarType } from '@/components/bo_avatar'; | ||
import { BoSize } from '@/global'; | ||
import { StorybookUtils } from '@/utils'; | ||
import type { Meta, StoryObj } from '@storybook/vue3'; | ||
|
||
const meta = { | ||
title: 'Components/bo-avatar', | ||
component: BoAvatar, | ||
argTypes: { | ||
size: { | ||
description: 'The size of the avatar', | ||
table: { | ||
category: 'props', | ||
subcategory: 'optional', | ||
type: { | ||
summary: 'BoSize', | ||
detail: StorybookUtils.stringEnumFormatter(BoSize, 'BoSize'), | ||
}, | ||
}, | ||
control: { type: 'select' }, | ||
options: Object.values(BoSize), | ||
}, | ||
type: { | ||
description: 'The type of the avatar', | ||
table: { | ||
category: 'props', | ||
subcategory: 'optional', | ||
type: { | ||
summary: 'BoAvatarType', | ||
detail: StorybookUtils.stringEnumFormatter( | ||
BoAvatarType, | ||
'BoAvatarType', | ||
), | ||
}, | ||
}, | ||
control: { type: 'select' }, | ||
options: Object.values(BoAvatarType), | ||
}, | ||
text: { | ||
description: | ||
'Object containing the text to be displayed and the alt text', | ||
table: { | ||
category: 'props', | ||
subcategory: 'optional', | ||
type: { | ||
summary: 'AvatarTextArgs', | ||
detail: StorybookUtils.stringEnumFormatter( | ||
BoAvatarType, | ||
'AvatarTextArgs', | ||
), | ||
}, | ||
}, | ||
control: { type: 'object' }, | ||
}, | ||
image: { | ||
description: | ||
'Object containing the image to be displayed and the alt text', | ||
table: { | ||
category: 'props', | ||
subcategory: 'optional', | ||
type: { | ||
summary: 'AvatarImageArgs', | ||
detail: StorybookUtils.stringEnumFormatter( | ||
BoAvatarType, | ||
'AvatarImageArgs', | ||
), | ||
}, | ||
}, | ||
control: { type: 'object' }, | ||
}, | ||
}, | ||
} satisfies Meta<typeof BoAvatar>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Example: Story = { | ||
args: { | ||
size: BoSize.default, | ||
type: BoAvatarType.image, | ||
image: { | ||
src: '@/assets/avatar.svg', | ||
alt: 'user-avatar', | ||
}, | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
import type { BoVariant } from '@/global'; | ||
export enum BoAvatarType { | ||
image = 'image', | ||
text = 'text', | ||
} | ||
|
||
export type AvatarImageArgs = { | ||
src: string; | ||
alt?: string; | ||
}; | ||
|
||
export type AvatarTextArgs = { | ||
initial: string; | ||
value: string; | ||
alt?: string; | ||
backgroundColor?: string; | ||
}; | ||
|
||
export type AvatarComponentProps = { | ||
size?: string; | ||
type: BoAvatarType; | ||
text?: AvatarTextArgs; | ||
image?: AvatarImageArgs; | ||
variant?: BoVariant; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export enum BoStatus { | ||
online = 'online', | ||
busy = 'busy', | ||
away = 'away', | ||
offline = 'offline', | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { BoColor } from './bo_color'; | ||
export { BoSize } from './bo_size'; | ||
export { BoStatus } from './bo_status'; | ||
export { BoVariant } from './bo_variant'; |