-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create VTag component #3137
Merged
Merged
Create VTag component #3137
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
afbd407
create VTag component
ngken0995 00cd837
revise VTag and VMediaTags
ngken0995 c8df0a0
revise test and update VMediaTags
44f6545
run just lint
ngken0995 3726c7c
revise VTag storybook
ngken0995 1b5e998
revise VTag storybook
ngken0995 84c6d64
Update frontend/src/components/VTag/meta/VTag.stories.mdx
obulat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 } | ||
}, | ||
}) | ||
|
||
# tag | ||
obulat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<Description of={VTag} /> | ||
|
||
<ArgsTable of={VTag} /> | ||
|
||
<Canvas> | ||
<Story | ||
name="default" | ||
args={{ | ||
title: "cat", | ||
href: "#", | ||
}} | ||
> | ||
{Template.bind({})} | ||
</Story> | ||
</Canvas> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add
v-else
toVMediaTag
here, it will be hidden whenadditionalSearchViews
is true, so there'll be no duplication of tags.