-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from vividroyjeong/feature/storybook
Feature/storybook
- Loading branch information
Showing
18 changed files
with
617 additions
and
245 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
80 changes: 80 additions & 0 deletions
80
frontend/src/components/common/AppMessageDialog.stories.ts
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,80 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3' | ||
import AppMessageDialog from '@/components/common/AppMessageDialog.vue' | ||
|
||
const meta: Meta<typeof AppMessageDialog> = { | ||
title: 'components/common/AppMessageDialog', | ||
component: AppMessageDialog, | ||
argTypes: { | ||
dialog: { | ||
control: 'boolean', | ||
description: 'Dialog visibility', | ||
defaultValue: true, | ||
}, | ||
title: { | ||
control: 'text', | ||
description: 'Dialog title', | ||
defaultValue: 'VDYP Message', | ||
}, | ||
message: { | ||
control: 'text', | ||
description: 'Dialog message', | ||
defaultValue: 'This is a message.', | ||
}, | ||
dialogWidth: { | ||
control: { type: 'range', min: 200, max: 800, step: 50 }, | ||
description: 'Dialog width', | ||
defaultValue: 400, | ||
}, | ||
dialogBorderRadius: { | ||
control: { type: 'range', min: 0, max: 50, step: 1 }, | ||
description: 'Dialog border radius', | ||
defaultValue: 8, | ||
}, | ||
btnLabel: { | ||
control: 'text', | ||
description: 'Button label', | ||
defaultValue: 'OK', | ||
}, | ||
headerBackground: { | ||
control: 'color', | ||
description: 'Background color for header', | ||
defaultValue: '#003366', | ||
}, | ||
headerColor: { | ||
control: 'color', | ||
description: 'Color for header', | ||
defaultValue: '#ffffff', | ||
}, | ||
actionsBackground: { | ||
control: 'color', | ||
description: 'Background color for actions', | ||
defaultValue: '#f6f6f6', | ||
}, | ||
'onUpdate:dialog': { | ||
action: 'update:dialog', | ||
description: 'Emitted when dialog state changes', | ||
}, | ||
onClose: { | ||
action: 'close', | ||
description: 'Emitted when close button is clicked', | ||
}, | ||
}, | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof AppMessageDialog> | ||
|
||
export const Primary: Story = { | ||
args: { | ||
dialog: true, | ||
title: 'Missing Information', | ||
message: | ||
'Input field is missing essential information which must be filled in order to confirm and continue.', | ||
dialogWidth: 400, | ||
dialogBorderRadius: 8, | ||
btnLabel: 'Continue Editing', | ||
headerBackground: '#003366', | ||
headerColor: '#ffffff', | ||
actionsBackground: '#f6f6f6', | ||
}, | ||
} |
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,49 +1,24 @@ | ||
<template> | ||
<div> | ||
<v-snackbar | ||
v-model="isShow" | ||
:timeout="NOTIFICATION.SHOW_TIME" | ||
:color="type || 'info'" | ||
class="elevation-12" | ||
location="top" | ||
@click:outside="closeMessage" | ||
> | ||
<div class="d-flex align-center"> | ||
<v-icon class="mr-2">{{ getIcon(type) }}</v-icon> | ||
<span> {{ message || 'Notification message' }}</span> | ||
</div> | ||
|
||
<template #actions> | ||
<v-btn icon variant="text" @click="closeMessage"> | ||
<v-icon>mdi-close</v-icon> | ||
</v-btn> | ||
</template> | ||
</v-snackbar> | ||
</div> | ||
<AppSnackbar | ||
:is-visible="isShow" | ||
:message="message" | ||
:type="type" | ||
:color="color" | ||
:timeout="NOTIFICATION.SHOW_TIME" | ||
@close="closeMessage" | ||
/> | ||
</template> | ||
<script setup lang="ts"> | ||
import { storeToRefs } from 'pinia' | ||
import { useNotificationStore } from '@/stores/common/notificationStore' | ||
import type { MessageType } from '@/types/types' | ||
import AppSnackbar from './AppSnackbar.vue' | ||
import { NOTIFICATION } from '@/constants/constants' | ||
const notificationStore = useNotificationStore() | ||
const { isShow, message, type } = storeToRefs(notificationStore) | ||
const { isShow, message, type, color } = storeToRefs(notificationStore) | ||
const closeMessage = () => { | ||
notificationStore.resetMessage() | ||
} | ||
const getIcon = (type: MessageType) => { | ||
const icon: { [key in MessageType]: string } = { | ||
'': '', | ||
info: 'mdi-information', | ||
success: 'mdi-check-circle', | ||
error: 'mdi-alert-circle', | ||
warning: 'mdi-alert', | ||
} | ||
return icon[type] || 'mdi-information' | ||
} | ||
</script> |
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
Oops, something went wrong.