Skip to content
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

設定ダイアログのリデザイン #2276

Merged
merged 44 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4f30740
不要な記述を削除
takusea Sep 28, 2024
a130400
スタイルの微調整
takusea Sep 28, 2024
558f178
ClickableでないBaseRowCardにフォーカスできないようにする
takusea Sep 28, 2024
0b3577a
幅が狭いときに要素を崩れずに折り返すように修正
takusea Sep 28, 2024
5f94cc4
不要な記述を削除
takusea Sep 28, 2024
1cd43ac
ToolTipと共存できるようにCSSセレクタを変更
takusea Sep 28, 2024
aedf758
BaseCheckboxコンポーネントを追加
takusea Sep 29, 2024
29088c0
BaseSelect関連コンポーネントを追加
takusea Sep 29, 2024
3c06f19
BaseRowCardを使った実装に変更
takusea Sep 29, 2024
040b4af
BaseRowCardとほぼ同一になったため削除
takusea Sep 29, 2024
da97e47
SettingDialog内のコンポーネントを新コンポーネントに置き換え
takusea Sep 29, 2024
622a00b
BaseCheckboxのStoryファイルを追加
takusea Sep 29, 2024
04a075f
testの内容を実装の変更に合わせて更新
takusea Sep 29, 2024
d81ebb4
テキストカラーをより濃い色に変更
takusea Oct 1, 2024
0230e60
要素の折り返しをより幅が狭いときに行われるように変更
takusea Oct 1, 2024
b731ca0
テキストの見た目を調整
takusea Oct 1, 2024
c95aff2
誤字を修正
takusea Oct 1, 2024
7547ca2
outputSamplingRateへの代入時の型を修正
takusea Oct 3, 2024
f690f3e
Checkbox間の間隔を空ける
takusea Oct 3, 2024
32885e9
setting-dialogのCSS記述の調整
takusea Oct 3, 2024
c52a723
コメント付与
takusea Oct 3, 2024
226ec23
radix-vueを更新
takusea Oct 3, 2024
44bee2a
z-indexをdata-radix-popper-content-wrapperで指定しないよう変更
takusea Oct 3, 2024
bc60535
:globalを:deepに変更
takusea Oct 3, 2024
687a4ae
不要な記述を削除
takusea Oct 3, 2024
17e1be4
disabled状態の追加
takusea Oct 4, 2024
ba47540
SelectCellを追加
takusea Oct 4, 2024
cc4b786
BaseSelectのopen状態を外から変更できるように
takusea Oct 4, 2024
8e37d44
Switchにdisabled状態を追加
takusea Oct 4, 2024
83249e7
SelectCellの追加・disabledの修正
takusea Oct 4, 2024
cafa05c
不要なクラス指定を削除
takusea Oct 4, 2024
3ae63fa
ToggleCellのSwitchのラベルを削除
takusea Oct 6, 2024
32d15f0
つまみにチェックマークを追加
takusea Oct 6, 2024
34fb1a6
コメントを付与
takusea Oct 6, 2024
5a46ef6
ホバー・クリック時の色のアニメーションを削除
takusea Oct 8, 2024
689c85b
矢印を非表示に
takusea Oct 11, 2024
1a64b3a
Merge remote-tracking branch 'upstream/main' into pr/takusea/2276-3
Hiroshiba Oct 12, 2024
a0d5c00
Merge remote-tracking branch 'upstream/main' into pr/takusea/2276-3
Hiroshiba Oct 12, 2024
77aad10
[update snapshots]
Hiroshiba Oct 12, 2024
32415f2
書き出しファイル名パターンのe2eテスト修正
Hiroshiba Oct 12, 2024
13ec982
[update snapshots]
Hiroshiba Oct 12, 2024
ff8124b
(スナップショットを更新)
github-actions[bot] Oct 12, 2024
b8be71d
test
Hiroshiba Oct 12, 2024
77898f1
Merge branch 'redesign-setting-dialog' of github.com:takusea/voicevox…
Hiroshiba Oct 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/components/Base/BaseCheckbox.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { Meta, StoryObj } from "@storybook/vue3";

import BaseCheckbox from "./BaseCheckbox.vue";

const meta: Meta<typeof BaseCheckbox> = {
component: BaseCheckbox,
};

export default meta;
type Story = StoryObj<typeof BaseCheckbox>;

export const Default: Story = {
args: {
label: "Default",
checked: false,
},
};

export const Checked: Story = {
...Default,
args: {
label: "Checked",
checked: true,
},
};
56 changes: 56 additions & 0 deletions src/components/Base/BaseCheckbox.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<template>
<label class="root">
<CheckboxRoot v-model:checked="checked" class="CheckboxRoot">
<CheckboxIndicator class="CheckboxIndicator">
<QIcon class="check" name="check" />
</CheckboxIndicator>
</CheckboxRoot>
{{ label }}
</label>
</template>

<script setup lang="ts">
import { CheckboxIndicator, CheckboxRoot } from "radix-vue";

defineProps<{ label: string }>();

const checked = defineModel<boolean>("checked");
</script>

<style scoped lang="scss">
@use "@/styles/v2/variables" as vars;
@use "@/styles/v2/mixin" as mixin;
@use "@/styles/v2/colors" as colors;

.root {
display: flex;
align-items: center;
justify-content: center;
gap: vars.$gap-1;
cursor: pointer;
}

:deep(.CheckboxRoot) {
padding: 0;
background-color: colors.$background;
height: vars.$size-indicator;
width: vars.$size-indicator;
border: 1px solid colors.$border;
border-radius: vars.$radius-1;
color: white;
cursor: pointer;

&[data-state="checked"] {
background-color: colors.$primary;
}

&:focus-visible {
@include mixin.on-focus;
}
}

.CheckboxIndicator {
display: grid;
place-items: center;
}
</style>
27 changes: 22 additions & 5 deletions src/components/Base/BaseRowCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class="row-card"
:class="{ clickable: clickable }"
role="listitem"
:tabindex="clickable ? 0 : -1"
@click="(payload) => $emit('click', payload)"
>
<div class="text">
Expand All @@ -19,7 +20,7 @@
defineProps<{
title: string;
description?: string;
clickable: boolean;
clickable?: boolean;
}>();

defineEmits<{
Expand All @@ -33,8 +34,8 @@ defineEmits<{
@use "@/styles/v2/colors" as colors;

.row-card {
display: grid;
grid-template-columns: 1fr auto;
display: flex;
flex-wrap: wrap;
text-align: unset;
align-items: center;
border: 1px solid colors.$border;
Expand Down Expand Up @@ -64,10 +65,26 @@ defineEmits<{
}

.text {
flex-grow: 1;
flex: 1;
min-width: 240px;
}

.title {
font-weight: 700;
}

.description {
font-size: 0.75rem;
// TODO: html要素のfont-size指定が16pxになり次第remでの指定に変更する
// font-size: 0.75rem;
font-size: 12px;
}

.control {
display: flex;
flex-wrap: wrap;
justify-content: right;
align-items: center;
gap: vars.$gap-1;
margin-left: auto;
}
</style>
121 changes: 121 additions & 0 deletions src/components/Base/BaseSelect.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<template>
<SelectRoot v-model="model" :defaultValue :disabled>
<SelectTrigger class="SelectTrigger">
<SelectValue class="SelectValue" :placeholder />
<SelectIcon class="SelectIcon">
<!-- 暫定でq-iconを使用 -->
<QIcon name="keyboard_arrow_down" size="sm" />
</SelectIcon>
</SelectTrigger>

<SelectPortal>
<SelectContent
class="SelectContent"
position="popper"
:sideOffset="4"
:collisionPadding="8"
:arrowPadding="16"
avoidCollisions
hideWhenDetached
>
<SelectViewport>
<slot />
</SelectViewport>
<SelectArrow class="SelectArrow" />
</SelectContent>
</SelectPortal>
</SelectRoot>
</template>

<script setup lang="ts">
import {
SelectContent,
SelectPortal,
SelectRoot,
SelectIcon,
SelectArrow,
SelectTrigger,
SelectValue,
SelectViewport,
} from "radix-vue";

defineProps<{
placeholder?: string;
defaultValue?: string;
disabled?: boolean;
}>();

const model = defineModel<string>();
</script>

<style scoped lang="scss">
@use "@/styles/v2/variables" as vars;
@use "@/styles/v2/colors" as colors;
@use "@/styles/v2/mixin" as mixin;

.SelectTrigger {
display: flex;
justify-content: space-between;
align-items: center;
min-height: vars.$size-control;
border-radius: vars.$radius-1;
padding-inline: vars.$padding-2 vars.$padding-1;
gap: vars.$gap-1;
border: 1px solid;
text-align: start;
transition: background-color vars.$transition-duration;
cursor: pointer;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
color: colors.$display;
border-color: colors.$border;
background-color: colors.$control;

&:hover:not(:disabled) {
background-color: colors.$control-hovered;
}

&:active:not(:disabled) {
background-color: colors.$control-pressed;
}

&:active:not(:disabled) {
box-shadow: 0 0 0 transparent;
}

&:focus-visible {
@include mixin.on-focus;
}

&[data-placeholder] {
color: colors.$display-sub;
}
}

.SelectIcon {
color: colors.$display;
}

:global([data-radix-popper-content-wrapper]) {
z-index: vars.$z-index-dropdown !important;
}
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved

:global(.SelectContent) {
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
overflow: hidden;
display: flex;
border-radius: vars.$radius-2;
padding: vars.$padding-1;
color: colors.$display;
background-color: colors.$background;
border: 1px solid colors.$border;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
min-width: var(--radix-select-trigger-width);
max-width: var(--radix-select-content-available-width);
max-height: var(--radix-select-content-available-height);
}

:global(.SelectArrow) {
fill: colors.$background;
margin-top: -1px;
filter: drop-shadow(0 1px 0px colors.$border);
}
</style>
79 changes: 79 additions & 0 deletions src/components/Base/BaseSelectItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<template>
<SelectItem class="SelectItem" :value :disabled>
<SelectItemText>{{ label }}</SelectItemText>
<SelectItemIndicator class="SelectItemIndicator" />
</SelectItem>
</template>

<script setup lang="ts">
import { SelectItem, SelectItemText, SelectItemIndicator } from "radix-vue";

defineProps<{
value: string;
label: string;
disabled?: boolean;
}>();
</script>

<style scoped lang="scss">
@use "@/styles/v2/variables" as vars;
@use "@/styles/v2/mixin" as mixin;
@use "@/styles/v2/colors" as colors;

.SelectItem {
color: colors.$display;
cursor: pointer;
position: relative;
min-height: vars.$size-control;
display: flex;
align-items: center;
background-color: colors.$clear;
border: none;
padding: vars.$padding-1 vars.$padding-2;
border-radius: vars.$radius-1;
transition: background-color vars.$transition-duration;

&:not([data-state="checked"]):hover {
background-color: colors.$clear-hovered;
}

&:not([data-state="checked"]):active {
background-color: colors.$clear-pressed;
}

&:focus-visible {
@include mixin.on-focus;
outline-offset: -2px;
}

&[data-highlighted] {
background-color: colors.$clear-hovered;
}

&[data-state="checked"] {
background-color: colors.$selected;
}

&[data-disabled] {
opacity: 0.5;
pointer-events: none;
}
}

.SelectItemIndicator {
position: absolute;
left: 6px;
height: 0;
width: 4px;
border-radius: 2px;
background-color: colors.$primary;
opacity: 0;
transition-duration: vars.$transition-duration;
transition-property: height opacity;
}

[data-state="checked"] > .SelectItemIndicator {
opacity: 1;
height: 16px;
}
</style>
3 changes: 0 additions & 3 deletions src/components/Base/BaseToggleGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,5 @@ defineEmits<{

.ToggleGroup {
display: inline-flex;
background-color: var(--mauve-6);
border-radius: 4px;
box-shadow: 0 2px 10px var(--black-a7);
}
</style>
13 changes: 6 additions & 7 deletions src/components/Base/BaseToggleGroupItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ defineProps<{
align-items: center;
height: vars.$size-control;
border: 1px solid;
transition:
background-color vars.$transition-duration,
padding vars.$transition-duration;
transition-duration: vars.$transition-duration;
transition-property: background-color, color, padding, box-shadow;
cursor: pointer;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);

&:active:not(:disabled) {
box-shadow: 0 0 0 transparent;
Expand All @@ -48,12 +46,13 @@ defineProps<{
border-bottom-right-radius: vars.$radius-1;
}

&[data-state="off"] {
&[aria-pressed="false"] {
padding: 0
calc(#{vars.$padding-1} + (#{vars.$size-icon} + #{vars.$gap-1}) / 2);
color: colors.$display;
border-color: colors.$border;
background-color: colors.$control;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);

&:hover:not(:disabled) {
background-color: colors.$control-hovered;
Expand All @@ -64,7 +63,7 @@ defineProps<{
}
}

&[data-state="on"] {
&[aria-pressed="true"] {
padding: 0 vars.$padding-1;
color: colors.$display-oncolor;
border-color: colors.$border;
Expand All @@ -91,7 +90,7 @@ defineProps<{
opacity vars.$transition-duration;
}

[data-state="off"] > .check {
[aria-pressed="false"] > .check {
width: 0;
opacity: 0;
margin-right: 0;
Expand Down
Loading
Loading