-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add collapse item some flexibility * chore: eslint fix * chore: eslint fix * feat: another approach * chore: prettier fix * fix: move 'div' into computed func * fix: move 'div' into computed func * fix: comment fix in if statement Co-authored-by: ViZhe <vizhe.cat@ya.ru> * fix: no need in optional params * fix: props types * fix: props types * fix: props types * feat: storybook story + small fixes * feat: style update 'cause of div * feat: docs page update * fix: define async icon comp * fix: script type module * fix: iframe height * fix: docs page * fix: docs page --------- Co-authored-by: ViZhe <vizhe.cat@ya.ru>
- Loading branch information
Showing
16 changed files
with
521 additions
and
11 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
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,104 @@ | ||
import type { Meta, Story } from '@storybook/vue3'; | ||
import { defineAsyncComponent, defineComponent, ref } from 'vue'; | ||
|
||
import { QCollapse, type QCollapseProps } from '@/qComponents/QCollapse'; | ||
import { QCollapseItem } from '@/qComponents/QCollapseItem'; | ||
|
||
type QCollapseStoryWithExtraControl = QCollapseProps & { customIcon: boolean }; | ||
|
||
const storyMetadata: Meta = { | ||
title: 'Components/QCollapse', | ||
component: QCollapse, | ||
subcomponents: { QCollapseItem }, | ||
argTypes: { | ||
customIcon: { | ||
control: { type: 'boolean' }, | ||
description: | ||
'Control display of the custom icon (demonstration purpose only)' | ||
}, | ||
openIcon: { control: { type: 'none' } }, | ||
closeIcon: { control: { type: 'none' } } | ||
} | ||
}; | ||
|
||
const QCollapseStory: Story<QCollapseStoryWithExtraControl> = args => | ||
defineComponent({ | ||
components: { QCollapse, QCollapseItem }, | ||
setup() { | ||
const activeNames = ref<string[]>(['1']); | ||
const iconUp = defineAsyncComponent( | ||
() => import('./icons/ChevronUp.vue') | ||
); | ||
const iconDown = defineAsyncComponent( | ||
() => import('./icons/ChevronDown.vue') | ||
); | ||
|
||
return { args, activeNames, iconUp, iconDown }; | ||
}, | ||
template: ` | ||
<q-collapse | ||
v-model="activeNames" | ||
:close-icon="args.customIcon ? iconDown : null" | ||
:open-icon="args.customIcon ? iconUp : null" | ||
:accordion="args.accordion" | ||
style="max-width:732px" | ||
> | ||
<q-collapse-item | ||
title="Consistency" | ||
name="1" | ||
> | ||
<div> | ||
Consistent with real life: in line with the process and logic of real | ||
life, and comply with languages and habits that the users are used to; | ||
</div> | ||
<div> | ||
Consistent within interface: all elements should be consistent, such as: | ||
design style, icons and texts, position of elements, etc. | ||
</div> | ||
</q-collapse-item> | ||
<q-collapse-item | ||
title="Controlled consequences: users should be granted the freedom to operate, including canceling, aborting or reflect current state by updat" | ||
> | ||
<div> | ||
Operation feedback: enable the users to clearly perceive their | ||
operations by style updates and interactive effects; | ||
</div> | ||
<div> | ||
Visual feedback: reflect current state by updating or rearranging | ||
elements of the page. | ||
</div> | ||
</q-collapse-item> | ||
<q-collapse-item title="Efficiency"> | ||
<div> | ||
Simplify the process: keep operating process simple and intuitive; | ||
</div> | ||
<div> | ||
Definite and clear: enunciate your intentions clearly so that the users | ||
can quickly understand and make decisions; | ||
</div> | ||
<div> | ||
Easy to identify: the interface should be straightforward, which helps | ||
the users to identify and frees them from memorizing and recalling. | ||
</div> | ||
</q-collapse-item> | ||
<q-collapse-item | ||
title="Controllability" | ||
name="4" | ||
> | ||
<div> | ||
Decision making: giving advices about operations is acceptable, but do | ||
not make decisions for the users; | ||
</div> | ||
<div> | ||
Controlled consequences: users should be granted the freedom to operate, | ||
including canceling, aborting or terminating current operation. | ||
</div> | ||
</q-collapse-item> | ||
</q-collapse> | ||
` | ||
}); | ||
|
||
export const CustomIcon = QCollapseStory.bind({ | ||
customIcon: false | ||
}); | ||
export default storyMetadata; |
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,22 @@ | ||
<template> | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M12.0002 15.713L18.0102 9.70299L16.5972 8.28799L12.0002 12.888L7.40423 8.28799L5.99023 9.70199L12.0002 15.713Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
export default defineComponent({ | ||
name: 'IconChevronDown' | ||
}); | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M12.0002 8.288L5.99023 14.298L7.40423 15.713L12.0042 11.113L16.6042 15.713L18.0112 14.298L12.0002 8.288Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue'; | ||
export default defineComponent({ | ||
name: 'IconChevronUp' | ||
}); | ||
</script> |
Oops, something went wrong.