-
Notifications
You must be signed in to change notification settings - Fork 0
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
ServiceAccordion の実装 #53
Changes from 6 commits
bbb1120
100367a
8fb41a2
47ec85a
e1382b1
cd52b09
747ac46
b157461
03cf009
b4f9a31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<script lang="ts" setup> | ||
import vSelect from 'vue-select' | ||
import 'vue-select/dist/vue-select.css' | ||
import { computed } from 'vue' | ||
import Icon from '/@/components/UI/Icon.vue' | ||
|
||
interface Props { | ||
modelValue: string | ||
options: string[] | ||
searchable?: boolean | ||
} | ||
|
||
const props = defineProps<Props>() | ||
|
||
const emit = defineEmits<{ | ||
(e: 'update:modelValue', value: string): void | ||
}>() | ||
|
||
const value = computed({ | ||
get: () => props.modelValue, | ||
set: v => emit('update:modelValue', v) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<v-select | ||
v-model="value" | ||
:options="options" | ||
:clearable="false" | ||
:class="$style.select" | ||
:searchable="searchable" | ||
> | ||
<template #option="{ label }"> | ||
<div :class="$style.item"> | ||
<icon | ||
v-if="value === label" | ||
name="mdi:tick-circle-outline" | ||
:class="$style.icon" | ||
/> | ||
<p :class="$style.label">{{ label }}</p> | ||
</div> | ||
</template> | ||
</v-select> | ||
</template> | ||
|
||
<style lang="scss" module> | ||
.item { | ||
display: grid; | ||
grid-template-columns: 24px 1fr; | ||
gap: 8px; | ||
.icon { | ||
color: $color-primary; | ||
} | ||
.label { | ||
grid-column: 2; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.select { | ||
--vs-border-radius: 8px; | ||
--vs-border-color: #{$color-primary}; | ||
|
||
// dropdown のスタイル | ||
:global(.vs__dropdown-menu) { | ||
margin-top: 8px; | ||
border-top-style: solid; | ||
border-radius: var(--vs-border-radius); | ||
--vs-dropdown-option-padding: 4px 8px; | ||
|
||
--vs-dropdown-option--active-bg: #{$color-background-dim}; | ||
--vs-dropdown-option--active-color: #{$color-text}; | ||
} | ||
|
||
// combobox のスタイル | ||
:global(.vs__dropdown-toggle) { | ||
--vs-selected-color: #{$color-text}; | ||
border-color: $color-secondary; | ||
border-radius: var(--vs-border-radius); | ||
|
||
// combobox の右側のアイコン | ||
--vs-actions-padding: 4px 8px 0 3px; | ||
--vs-controls-color: #{$color-secondary-text}; | ||
} | ||
|
||
// dropdown が開いているときの combobox のスタイル | ||
&:global(.vs--open) { | ||
:global(.vs__dropdown-toggle) { | ||
border-color: var(--vs-border-color); | ||
} | ||
|
||
:global(.vs__selected) { | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script lang="ts" setup> | ||
import { computed } from 'vue' | ||
import BaseSelect from '/@/components/UI/BaseSelect.vue' | ||
import { services, serviceNameToType } from '/@/consts/services' | ||
import { AccountType } from '/@/lib/apis' | ||
|
||
const options = Array.from(services.values()).map(service => service.name) | ||
|
||
interface Props { | ||
modelValue: AccountType | ||
} | ||
const props = defineProps<Props>() | ||
|
||
const emit = defineEmits<{ | ||
(e: 'update:modelValue', value: AccountType): void | ||
}>() | ||
|
||
const value = computed({ | ||
get: () => services.get(props.modelValue)?.name ?? '', | ||
set: v => | ||
emit('update:modelValue', serviceNameToType(v) ?? AccountType.homepage) | ||
}) | ||
</script> | ||
|
||
<template> | ||
<base-select v-model="value" :options="options" searchable /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 登録済みのサービスはdisableな見た目にして選択できない感じですかね? (もしくは、完全に表示しない) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 完全に表示しないのを想定していましたが、いい感じのUIにできそうであればdisableな見た目にした方が分かりやすいかもです🤨 |
||
</template> |
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.
選択したときの選択した感と、カーソル当てたときの検索できる感があんまりない気がするので
cursor
を選択肢をホバーしたときにpointer
、selectbox自体にカーソル当てたときにtext
にするのがいい気がします(これデフォルトでなってた気がするんですけどどこかで消してますっけ)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.
良さそうなのでやっておきます○
(デフォルトで
になってて、これがまずそう?)