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

ヘルプ画面のライセンス情報セクションのリデザイン #1650

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
86 changes: 86 additions & 0 deletions src/components/base/BaseButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<template>
<button
class="button"
:class="variant ? variant : 'default'"
@click="(payload) => $emit('click', payload)"
>
<q-icon v-if="icon" :name="icon" size="sm" />
{{ label }}
</button>
</template>

<script setup lang="ts">
defineProps<{
label: string;
icon?: string;
variant?: "default" | "primary" | "danger";
}>();

defineEmits<{
(e: "click", payload: MouseEvent): void;
}>();
</script>

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

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

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

.default {
color: #222;
background-color: #fff;
border-color: #0002;

&:hover:not(:disabled) {
background-color: #f4f5f4;
}

&:active:not(:disabled) {
background-color: #ebeceb;
}
}

.primary {
color: #fff;
border-color: #0002;
background-color: #a5d4ad;

&:hover:not(:disabled) {
background-color: #97cfa1;
}

&:active:not(:disabled) {
background-color: #86c291;
}
}

.danger {
color: #d04756;
border-color: #d04756;
background-color: #fff;

&:hover:not(:disabled) {
background-color: #ffe0e0;
}

&:active:not(:disabled) {
background-color: #ffc1c1;
}
}
</style>
64 changes: 64 additions & 0 deletions src/components/base/BaseRowCard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<template>
<button
class="row-card"
:class="{ clickable: clickable }"
@click="(payload) => $emit('click', payload)"
>
<div class="text">
<div class="title">{{ title }}</div>
<div class="description">{{ description }}</div>
</div>
<div class="control">
<slot />
</div>
</button>
</template>

<script setup lang="ts">
defineProps<{
title: string;
description?: string;
clickable: boolean;
}>();

defineEmits<{
(e: "click", payload: MouseEvent): void;
}>();
</script>

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

.row-card {
display: flex;
text-align: unset;
align-items: center;
border: 1px solid #0002;
background-color: #fff;
border-radius: vars.$radius-container;
padding: vars.$padding-container;
gap: vars.$gap-container;
transition: background-color vars.$transition-duration;
}

.clickable:not(:disabled) {
cursor: pointer;

&:hover {
background-color: #f4f5f4;
}

&:active {
background-color: #ebeceb;
}
}

.text {
flex-grow: 1;
}

.description {
font-size: 0.75rem;
}
</style>
2 changes: 1 addition & 1 deletion src/components/help/HelpDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@

<script setup lang="ts">
import { computed, ref, type Component } from "vue";
import OssLicense from "../template/OssLicenseSection.vue";
import HelpPolicy from "./HelpPolicy.vue";
import LibraryPolicy from "./LibraryPolicy.vue";
import HowToUse from "./HowToUse.vue";
import OssLicense from "./OssLicense.vue";
Comment on lines +89 to -92
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、以前のvueファイルはデリートでもいいかもです!
(消し忘れが発生しそう)

import UpdateInfo from "./UpdateInfo.vue";
import OssCommunityInfo from "./OssCommunityInfo.vue";
import QAndA from "./QAndA.vue";
Expand Down
85 changes: 85 additions & 0 deletions src/components/template/OssLicenseSection.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<template>
<div class="container">
<div v-if="detailIndex === undefined" class="inner inner-list">
<h1 class="headline">ライセンス情報</h1>
<div class="list">
<BaseRowCard
v-for="(license, index) in props.licenses"
:key="index"
:title="
license.name + (license.version ? ' | ' + license.version : '')
"
clickable
@click="selectLicenseIndex(index)"
>
<q-icon name="arrow_right" size="sm" />
</BaseRowCard>
</div>
</div>
<div v-else class="inner inner-detail">
<div>
<BaseButton
label="戻る"
icon="keyboard_arrow_left"
@click="selectLicenseIndex(undefined)"
/>
</div>
<h1 class="headline">{{ licenses[detailIndex].name }}</h1>
<pre>{{ licenses[detailIndex].text }}</pre>
</div>
</div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import BaseRowCard from "../base/BaseRowCard.vue";
import BaseButton from "../base/BaseButton.vue";

const props =
defineProps<{
licenses: Record<string, string>[];
}>();

const detailIndex = ref<number | undefined>(undefined);

const selectLicenseIndex = (index: number | undefined) => {
detailIndex.value = index;
};
</script>

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

.container {
// 親コンポーネントからheightを取得できないため一時的にcalcを使用、HelpDialogの構造を再設計後100%に変更する
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このコメント良いですね!!
FIXMEかTODO付けても良いかも?(まあ気分ぐらいの違いしかないですが)

// height: 100%;
height: calc(100vh - 90px);
overflow-y: auto;
background-color: #e9f3e7;
}

.inner {
display: flex;
flex-direction: column;
padding: vars.$padding-container;
gap: vars.$gap-container;
min-height: 100%;
}

.inner-detail {
background-color: #fff;
}

.headline {
font-size: 1.5rem;
line-height: 1;
margin: 0;
}

.list {
display: flex;
flex-direction: column;
gap: vars.$gap-control;
}
</style>
19 changes: 19 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,22 @@ $menubar-height: 24px;
$detail-view-splitter-cell-z-index: 2;

$character-item-size: 215px; // キャラクター並び替えダイアログなどでの1キャラ表示要素の横幅

$size-scrollbar: 8px;
$size-icon: 16px;
$size-indicator: 24px;
$size-control: 32px;
$size-listitem: 40px;
$size-fab: 48px;

$padding-control: 8px;
$padding-button: 16px;
$padding-container: 16px;

$gap-control: 8px;
$gap-container: 16px;

$radius-control: 8px;
$radius-container: 16px;

$transition-duration: 100ms;