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

エンジンの管理ダイアログのリデザイン #2255

Merged
merged 17 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions src/components/Base/BaseButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<button
class="button"
:class="variant ? variant : 'default'"
:disabled
@click="(payload) => $emit('click', payload)"
>
<!-- 暫定でq-iconを使用 -->
Expand All @@ -14,6 +15,7 @@
defineProps<{
label: string;
icon?: string;
disabled?: boolean;
variant?: "default" | "primary" | "danger";
}>();

Expand All @@ -31,6 +33,7 @@ defineEmits<{
display: flex;
justify-content: space-between;
align-items: center;
text-wrap: nowrap;
height: vars.$size-control;
border-radius: vars.$radius-1;
padding: 0 vars.$padding-2;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Base/BaseListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ defineEmits<{
color: colors.$display;
cursor: pointer;
position: relative;
height: vars.$size-listitem;
min-height: vars.$size-listitem;
display: flex;
align-items: center;
background-color: colors.$clear;
border: none;
padding: 0 vars.$padding-2;
padding: vars.$padding-1 vars.$padding-2;
border-radius: vars.$radius-1;
transition: background-color vars.$transition-duration;

Expand Down
27 changes: 27 additions & 0 deletions src/components/Base/BaseNavigationView.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Meta, StoryObj } from "@storybook/vue3";

import BaseNavigationView from "./BaseNavigationView.vue";
import BaseListItem from "./BaseListItem.vue";

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

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

export const Default: Story = {
render: (args) => ({
components: { BaseNavigationView, BaseListItem },
setup() {
return { args };
},
template: `
<BaseNavigationView style="width: 100%; height:480px" v-bind="args">
<template #sidebar>
<BaseListItem>ListItem</BaseListItem>
</template>
<div>Content</div>
</BaseNavigationView>`,
}),
};
46 changes: 46 additions & 0 deletions src/components/Base/BaseNavigationView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<template>
<div class="grid">
<div class="sidebar">
<BaseScrollArea>
<div class="sidebar-inner">
<slot name="sidebar" />
</div>
</BaseScrollArea>
</div>

<main class="content">
<slot />
</main>
</div>
</template>

<script setup lang="ts">
import BaseScrollArea from "./BaseScrollArea.vue";
</script>

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

// TODO: MenuBar+Header分のマージン。Dialogコンポーネント置き換え後削除
.grid {
height: calc(100vh - 90px);
display: grid;
grid-template-columns: auto 1fr;
grid-template-rows: 100%;
backdrop-filter: blur(32px);
background-color: colors.$background-drawer;
}

.sidebar-inner {
display: flex;
flex-direction: column;
padding: vars.$padding-2;
width: max-content;
}

.content {
background-color: colors.$background;
border-left: 1px solid colors.$border;
}
</style>
13 changes: 10 additions & 3 deletions src/components/Base/BaseScrollArea.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<ScrollAreaRoot class="ScrollAreaRoot" type="auto">
<ScrollAreaViewport class="ScrollAreaViewport">
<slot />
<ScrollAreaViewport asChild>
<div class="ScrollAreaViewport">
<slot />
</div>
</ScrollAreaViewport>
<ScrollAreaScrollbar class="ScrollAreaScrollbar" orientation="horizontal">
<ScrollAreaThumb class="ScrollAreaThumb">
Expand Down Expand Up @@ -37,11 +39,16 @@ import {
flex-direction: column;
}

.ScrollAreaViewport {
// 親要素のサイズいっぱいに広げさせるためプライベートなデータ属性を使用
:deep([data-radix-scroll-area-viewport]) {
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
width: 100%;
height: 100%;
}

:deep(.ScrollAreaViewport) {
height: 100%;
}

.ScrollAreaScrollbar {
user-select: none;
touch-action: none;
Expand Down
48 changes: 48 additions & 0 deletions src/components/Base/BaseTextField.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import type { Meta, StoryObj } from "@storybook/vue3";

import BaseTextField from "./BaseTextField.vue";

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

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

export const Default: Story = {};

export const Placeholder: Story = {
args: {
placeholder: "Placeholder",
},
};

export const Disabled: Story = {
args: {
disabled: true,
},
};

export const ReadOnly: Story = {
args: {
readonly: true,
},
};

export const HasError: Story = {
args: {
hasError: true,
},
render: (args) => ({
components: { BaseTextField },
setup() {
return { args };
},
template: `
<BaseTextField v-bind="args">
<template #error>
ERROR TEXT
</template>
</BaseTextField>`,
}),
};
75 changes: 75 additions & 0 deletions src/components/Base/BaseTextField.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<div class="wrapper">
<input
v-model="model"
type="text"
class="input"
:class="{ error: hasError }"
:placeholder
:readonly
:disabled
@click="(payload) => $emit('click', payload)"
/>
<div v-if="hasError" class="error-label">
<slot name="error" />
</div>
</div>
</template>

<script setup lang="ts">
defineProps<{
placeholder?: string;
hasError?: boolean;
readonly?: boolean;
disabled?: boolean;
}>();

defineEmits<{
click: [payload: MouseEvent];
}>();

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;

.wrapper {
width: 100%;
}

.input {
height: vars.$size-control;
width: 100%;
display: flex;
align-items: center;
gap: vars.$gap-1;
border: 1px solid colors.$border;
border-radius: vars.$radius-1;
padding-inline: vars.$padding-1;
background-color: colors.$control;
color: colors.$display;

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

&:disabled {
opacity: 0.5;
}

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

.error {
border: 2px solid colors.$display-warning;
}

.error-label {
color: colors.$display-warning;
}
</style>
47 changes: 47 additions & 0 deletions src/components/Base/BaseToggleGroup.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { Meta, StoryObj } from "@storybook/vue3";

import BaseToggleGroup from "./BaseToggleGroup.vue";
import BaseToggleGroupItem from "./BaseToggleGroupItem.vue";

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

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

export const Single: Story = {
args: {
type: "single",
},
render: (args) => ({
components: { BaseToggleGroup, BaseToggleGroupItem },
setup() {
return { args };
},
template: `
<BaseToggleGroup v-bind="args">
<BaseToggleGroupItem label="A" value="a" />
<BaseToggleGroupItem label="B" value="B" />
<BaseToggleGroupItem label="C" value="C" />
</BaseToggleGroup>`,
}),
};

export const Multiple: Story = {
args: {
type: "multiple",
},
render: (args) => ({
components: { BaseToggleGroup, BaseToggleGroupItem },
setup() {
return { args };
},
template: `
<BaseToggleGroup v-bind="args">
<BaseToggleGroupItem label="A" value="a" />
<BaseToggleGroupItem label="B" value="B" />
<BaseToggleGroupItem label="C" value="C" />
</BaseToggleGroup>`,
}),
};
44 changes: 44 additions & 0 deletions src/components/Base/BaseToggleGroup.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<template>
<ToggleGroupRoot
class="ToggleGroup"
:type
:modelValue
:disabled
@update:modelValue="
(value) => {
if (value != undefined) {
$emit('update:modelValue', value);
}
}
"
>
<slot />
</ToggleGroupRoot>
</template>

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

defineProps<{
type: "single" | "multiple";
modelValue: string | string[];
disabled?: boolean;
}>();
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved

defineEmits<{
"update:modelValue": [payload: string | string[]];
}>();
</script>

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

.ToggleGroup {
display: inline-flex;
background-color: var(--mauve-6);
border-radius: 4px;
box-shadow: 0 2px 10px var(--black-a7);
}
</style>
Loading
Loading