-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(mirinae): refactor hook names and use-tab hook and add use-tab h…
…ook story (#4888) * refactor: change mirinae hook file names Signed-off-by: Wanjin Noh <[email protected]> * refactor: change mirinae use-tab hook arg names Signed-off-by: Wanjin Noh <[email protected]> * refactor: change use-select hook arg name and remove useless type Signed-off-by: Wanjin Noh <[email protected]> * docs: refactor use-tab hook and add story Signed-off-by: Wanjin Noh <[email protected]> * fix: do not use type as assertion Signed-off-by: Wanjin Noh <[email protected]> * docs: add blockquote style to storybook Signed-off-by: Wanjin Noh <[email protected]> * docs: apply review Signed-off-by: Wanjin Noh <[email protected]> * docs: fix wrong import Signed-off-by: Wanjin Noh <[email protected]> --------- Signed-off-by: Wanjin Noh <[email protected]>
- Loading branch information
Showing
42 changed files
with
544 additions
and
131 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
File renamed without changes.
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,6 +1,6 @@ | ||
export const ANIMATION_TYPE = { | ||
spin: 'spin', | ||
reserveSpin: 'reserve-spin', | ||
}; | ||
} as const; | ||
|
||
export type AnimationType = typeof ANIMATION_TYPE[keyof typeof ANIMATION_TYPE]; |
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,25 @@ | ||
{/* hookGuidelines.mdx */} | ||
|
||
import { Meta } from '@storybook/blocks'; | ||
|
||
<Meta title="Hooks/Guidelines" /> | ||
|
||
# Hook Guidelines | ||
|
||
This document outlines the guidelines for creating and using hooks within the design system, as well as for external usage, ensuring consistency and clarity across all hooks. | ||
<br/> | ||
|
||
## 1. Hook Argument - Options | ||
|
||
- **Single Argument**: Every hook accepts a single argument, which is always an object. This object is referred to as the "Hook Options." | ||
- **Naming Convention**: The interface for these options follows the naming rule `HookNameOptions`, where `HookName` is the name of the specific hook. | ||
- **Example**: `UseTabOptions` | ||
<br/> | ||
|
||
## 2. Hook Returns | ||
|
||
- **Return Format**: Hooks always return a single object, called the "Hook Returns." | ||
- **Naming Convention**: The interface for the return object follows the naming rule `HookNameReturns`, where `HookName` is the name of the specific hook. | ||
- **Example**: `UseTabReturns` | ||
<br/> | ||
|
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,7 @@ | ||
import type { Meta } from '@storybook/vue'; | ||
|
||
const meta: Meta = { | ||
title: 'Hooks/Guidelines', | ||
}; | ||
|
||
export default meta; |
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,8 +1,8 @@ | ||
export * from './context-menu-controller'; | ||
export * from './context-menu-style'; | ||
export * from './query-search'; | ||
export * from './ignore-window-arrow-keydown-events'; | ||
export * from './list-focus'; | ||
export * from './proxy-state'; | ||
export * from './select'; | ||
export * from './tab'; | ||
export * from './use-context-menu-controller/use-context-menu-controller'; | ||
export * from './use-context-menu-style/use-context-menu-style'; | ||
export * from './use-query-search/use-query-search'; | ||
export * from './use-ignore-window-arrow-keydown-events/use-ignore-window-arrow-keydown-events'; | ||
export * from './use-list-focus/use-list-focus'; | ||
export * from './use-proxy-state/use-proxy-state'; | ||
export * from './use-select/use-select'; | ||
export * from './use-tab/use-tab'; |
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,36 @@ | ||
import type { ComputedRef, Ref } from 'vue'; | ||
|
||
import type { TranslateResult } from 'vue-i18n'; | ||
|
||
/* Generic type T represents the additional properties that can be added to the tab item. */ | ||
export type TabItem<T extends object> = { | ||
/* name: The identifier for the tab. */ | ||
name: string; | ||
/* label: The display label for the tab. This supports localized string or other message formats. */ | ||
label?: TranslateResult; | ||
/* keepAlive: A flag indicating if the tab should be preserved when switching to other tabs. */ | ||
keepAlive?: boolean; | ||
/* subItems: An array containing nested `TabItem` elements for hierarchical tab structures. */ | ||
subItems?: Array<string|TabItem<T>>; | ||
} & T; | ||
|
||
export interface UseTabOptions<T extends object> { | ||
/* tabs: An array containing tab information. Each tab can be a `string` or an object that follows the `TabItem` structure. */ | ||
tabs: Ref<Array<string|TabItem<T>>> | Array<string|TabItem<T>>; | ||
/* activeTab: Represents the currently active tab. */ | ||
activeTab: Ref<string> | string; | ||
/* defaultItem: An object that provides default properties for all generated tabs. | ||
This ensures consistency across tab items when only partial information is provided. */ | ||
defaultItem?: T; | ||
} | ||
|
||
export interface UseTabReturns<T extends object> { | ||
/* tabItems: An array containing the resolved tab items based on the `tabs` input and the optional `defaultItem`. It provides a processed list of tabs with consistent structure. */ | ||
tabItems: ComputedRef<TabItem<T>[]>; | ||
/* keepAliveTabNames: An array listing the names of tabs marked to be kept alive (`keepAlive: true`.) */ | ||
keepAliveTabNames: ComputedRef<string[]>; | ||
/* nonKeepAliveTabNames: An array listing the names of tabs not set to be kept alive. */ | ||
nonKeepAliveTabNames: ComputedRef<string[]>; | ||
/* currentTabItem: Represents the currently active tab item based on the `activeTab` input. If no matching tab is found, it returns `undefined`. */ | ||
currentTabItem: ComputedRef<TabItem<T>|undefined>; | ||
} |
Oops, something went wrong.