Skip to content

Commit

Permalink
Merge pull request #60 from traPtitech/soramea/fix-chip
Browse files Browse the repository at this point in the history
chip の close icon 関連の修正
  • Loading branch information
soramea authored Dec 23, 2024
2 parents 1935cac + 5401f16 commit 4ae919b
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions src/shared/components/ChipButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,52 @@ import IconPlus from './IconPlus.vue';
const props = defineProps<{
label: string;
type: 'default' | 'new';
type: 'default' | 'show-close' | 'new';
}>();
defineEmits(['action']);
defineEmits(['action', 'close']);
const chipStyle = computed(() => ({
'button-chip': props.type === 'default',
'button-chip': props.type === 'default' || props.type === 'show-close',
'button-newchip': props.type === 'new',
}));
</script>

<template>
<Button class="button" :class="chipStyle" @click="$emit('action')">
<span>{{ label }}</span>
<IconClose v-if="type === 'default'" />
<IconPlus v-else-if="type === 'new'" />
</Button>
<div class="background" :class="chipStyle">
<Button class="button" :class="chipStyle" @click="$emit('action')">
<div class="button-content">
<span>{{ props.label }}</span>
<IconPlus v-if="props.type === 'new'" />
</div>
</Button>
<Button
v-if="props.type === 'show-close'"
class="button"
:class="chipStyle"
@click="$emit('close')"
>
<IconClose />
</Button>
</div>
</template>
<style lang="scss" scoped>
.button {
.background {
display: inline flex;
gap: 8px;
height: 32px;
padding: 4px 12px;
border-radius: 16px;
padding: 4px 12px;
}
.button {
padding: 0;
font-size: 16px;
font-weight: 700;
line-height: normal;
}
.button-content {
display: flex;
gap: 8px;
}
.button-chip {
background-color: $color-container-primary;
border-color: $color-container-primary;
Expand Down

0 comments on commit 4ae919b

Please sign in to comment.