From 50406eff90e3fe3a0cf927b12c11e17df741d206 Mon Sep 17 00:00:00 2001 From: ibeloyar Date: Fri, 20 Dec 2024 08:59:19 +0300 Subject: [PATCH] feat: chip --- src/components/FirChip/FirChip.stories.ts | 53 +++++++++++++++++++---- src/components/FirChip/FirChip.types.ts | 1 + src/components/FirChip/FirChip.vue | 29 +++++++++++-- 3 files changed, 70 insertions(+), 13 deletions(-) diff --git a/src/components/FirChip/FirChip.stories.ts b/src/components/FirChip/FirChip.stories.ts index 2985d11..12aa5e8 100644 --- a/src/components/FirChip/FirChip.stories.ts +++ b/src/components/FirChip/FirChip.stories.ts @@ -12,8 +12,9 @@ const meta = { view: { type: 'string', description: 'Chip view type', control: 'select', options: ['filled', 'outlined', 'double'] }, color: { type: 'string', description: 'Chip color', control: 'select', options: ['red', 'yellow', 'green', 'blue', 'gray', 'custom'] }, title: { type: 'string', description: 'Left side title', control: 'text' }, - bgCustomColor: { type: 'string', description: 'Background chip custom color', control: 'text' }, - textCustomColor: { type: 'string', description: 'Text chip custom color', control: 'text' }, + bgCustomColor: { type: 'string', description: 'Background chip custom color', control: 'color' }, + textCustomColor: { type: 'string', description: 'Text chip custom color', control: 'color' }, + titleCustomColor: { type: 'string', description: 'Title chip custom color', control: 'color' }, }, parameters: { slots: { @@ -45,12 +46,46 @@ export const Double: Story = { }, }; -export const Custom: Story = { +export const Custom: Story = { args: { - view: 'filled', - default: 'chip', - color: 'custom', - bgCustomColor: '#ae23b9', - textCustomColor: 'white' + color: 'blue', + default: 'chip' }, -}; \ No newline at end of file + render: () => ({ + components: { FirChip }, + template: ` +
+ + + chip 1 + + + + chip 2 + + + + chip 3 + + +
+ ` + }) +}; diff --git a/src/components/FirChip/FirChip.types.ts b/src/components/FirChip/FirChip.types.ts index 9dac165..6b578c8 100644 --- a/src/components/FirChip/FirChip.types.ts +++ b/src/components/FirChip/FirChip.types.ts @@ -3,6 +3,7 @@ export interface FirChipProps { color: 'custom' | 'red' | 'yellow' | 'green' | 'blue' | 'gray'; bgCustomColor?: string; textCustomColor?: string; + titleCustomColor?: string; title?: string; onClick?: () => void; } \ No newline at end of file diff --git a/src/components/FirChip/FirChip.vue b/src/components/FirChip/FirChip.vue index 12c810f..fe1294f 100644 --- a/src/components/FirChip/FirChip.vue +++ b/src/components/FirChip/FirChip.vue @@ -7,11 +7,12 @@ }" @click="onAction" @keyup.prevent - :style="{ ['background-color']: `${props.bgCustomColor}` }" + :style="wrapperStyles" > {{ props.title }} @@ -25,17 +26,33 @@