-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create VTag component * revise VTag and VMediaTags * revise test and update VMediaTags * run just lint * revise VTag storybook * revise VTag storybook * Update frontend/src/components/VTag/meta/VTag.stories.mdx --------- Co-authored-by: Panisa Busayanont <[email protected]> Co-authored-by: Olga Bulat <[email protected]>
- Loading branch information
1 parent
ad4c814
commit 2e4cc83
Showing
3 changed files
with
102 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
<template> | ||
<ul v-if="tags.length" class="flex flex-wrap gap-2"> | ||
<ul v-if="tags.length && additionalSearchViews" class="flex flex-wrap gap-2"> | ||
<VTag | ||
v-for="(tag, index) in tags" | ||
:key="index" | ||
href="/" | ||
:title="tag.name" | ||
/> | ||
</ul> | ||
<ul v-else> | ||
<VMediaTag v-for="(tag, index) in tags" :key="index" tag="li">{{ | ||
tag.name | ||
}}</VMediaTag> | ||
</ul> | ||
</template> | ||
<script lang="ts"> | ||
import { defineComponent, PropType } from "vue" | ||
import { computed, defineComponent, PropType } from "vue" | ||
import type { Tag } from "~/types/media" | ||
import { useFeatureFlagStore } from "~/stores/feature-flag" | ||
import VMediaTag from "~/components/VMediaTag/VMediaTag.vue" | ||
import VTag from "~/components/VTag/VTag.vue" | ||
export default defineComponent({ | ||
name: "VMediaTags", | ||
components: { VMediaTag }, | ||
components: { VMediaTag, VTag }, | ||
props: { | ||
tags: { | ||
type: Array as PropType<Tag[]>, | ||
required: true, | ||
}, | ||
}, | ||
setup() { | ||
const featureFlagStore = useFeatureFlagStore() | ||
const additionalSearchViews = computed(() => | ||
featureFlagStore.isOn("additional_search_views") | ||
) | ||
return { additionalSearchViews } | ||
}, | ||
}) | ||
</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,31 @@ | ||
<template> | ||
<VButton | ||
as="VLink" | ||
size="small" | ||
variant="filled-gray" | ||
class="label-bold" | ||
:href="href" | ||
>{{ title }}</VButton | ||
> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from "vue" | ||
import VButton from "~/components/VButton.vue" | ||
export default defineComponent({ | ||
name: "VTag", | ||
components: { VButton }, | ||
props: { | ||
title: { | ||
type: String, | ||
required: true, | ||
}, | ||
href: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
}) | ||
</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,48 @@ | ||
import { | ||
ArgsTable, | ||
Canvas, | ||
Description, | ||
Meta, | ||
Story, | ||
} from "@storybook/addon-docs" | ||
|
||
import VTag from "~/components/VTag/VTag.vue" | ||
|
||
<Meta | ||
title="Components/VTag" | ||
component={VTag} | ||
argTypes={{ | ||
title: { | ||
type: "text", | ||
}, | ||
href: { | ||
type: "text", | ||
}, | ||
}} | ||
/> | ||
|
||
export const Template = (args) => ({ | ||
template: `<VTag v-bind="args"/>`, | ||
components: { VTag }, | ||
setup() { | ||
return { args } | ||
}, | ||
}) | ||
|
||
# VTag | ||
|
||
<Description of={VTag} /> | ||
|
||
<ArgsTable of={VTag} /> | ||
|
||
<Canvas> | ||
<Story | ||
name="default" | ||
args={{ | ||
title: "cat", | ||
href: "#", | ||
}} | ||
> | ||
{Template.bind({})} | ||
</Story> | ||
</Canvas> |