diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-05-07 08:55:42 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-05-07 08:55:42 +0900 |
| commit | cdd131d542a9f8ef09870a65b1e91b647002f89a (patch) | |
| tree | f46ff60192590a6ef0044d8d711ccd5a86f24f18 /packages/frontend | |
| parent | 🎨 (diff) | |
| download | misskey-cdd131d542a9f8ef09870a65b1e91b647002f89a.tar.gz misskey-cdd131d542a9f8ef09870a65b1e91b647002f89a.tar.bz2 misskey-cdd131d542a9f8ef09870a65b1e91b647002f89a.zip | |
🎨
Diffstat (limited to 'packages/frontend')
| -rw-r--r-- | packages/frontend/src/components/global/MkResult.vue | 49 | ||||
| -rw-r--r-- | packages/frontend/src/components/global/MkSystemIcon.vue | 76 | ||||
| -rw-r--r-- | packages/frontend/src/components/index.ts | 3 |
3 files changed, 82 insertions, 46 deletions
diff --git a/packages/frontend/src/components/global/MkResult.vue b/packages/frontend/src/components/global/MkResult.vue index dda35babdc..bddc89809b 100644 --- a/packages/frontend/src/components/global/MkResult.vue +++ b/packages/frontend/src/components/global/MkResult.vue @@ -7,41 +7,11 @@ SPDX-License-Identifier: AGPL-3.0-only <Transition :name="prefer.s.animation ? '_transition_zoom' : ''" appear> <div :class="[$style.root, { [$style.warn]: type === 'notFound', [$style.error]: type === 'error' }]" class="_gaps_m"> <img v-if="type === 'empty' && instance.infoImageUrl" :src="instance.infoImageUrl" draggable="false" :class="$style.img"/> - <svg v-else-if="type === 'empty'" :class="$style.icon" viewBox="0 0 128 128" style="stroke-linecap:round;stroke-linejoin:round;"> - <g transform="matrix(1,0,0,0.9,0,12.8)"> - <path d="M64,88L64,48" style="fill:none;stroke:currentColor;stroke-width:8.41px;"/> - </g> - <g transform="matrix(1,0,0,1,-4,8)"> - <circle cx="68" cy="28" r="4" style="fill:currentColor;"/> - </g> - <g transform="matrix(0.875,0,0,0.875,8,8)"> - <circle cx="64" cy="64" r="64" style="fill:none;stroke:currentColor;stroke-width:9.14px;"/> - </g> - </svg> + <MkSystemIcon v-else-if="type === 'empty'" type="info" :class="$style.icon"/> <img v-if="type === 'notFound' && instance.notFoundImageUrl" :src="instance.notFoundImageUrl" draggable="false" :class="$style.img"/> - <svg v-else-if="type === 'notFound'" :class="$style.icon" viewBox="0 0 128 128" style="stroke-linecap:round;stroke-linejoin:round;"> - <g transform="matrix(1,0,0,1,0,12)"> - <path d="M64,64L64,56C72.533,55.777 80,49.333 80,40C80,31.667 73.333,24 64,24C55.667,24 47.556,31.667 48,40" style="fill:none;stroke:currentColor;stroke-width:8px;"/> - </g> - <g transform="matrix(1,0,0,1,-4,64)"> - <circle cx="68" cy="28" r="4" style="fill:currentColor;"/> - </g> - <g transform="matrix(0.875,0,0,0.875,8,8)"> - <circle cx="64" cy="64" r="64" style="fill:none;stroke:currentColor;stroke-width:9.14px;"/> - </g> - </svg> + <MkSystemIcon v-else-if="type === 'notFound'" type="question" :class="$style.icon"/> <img v-if="type === 'error' && instance.serverErrorImageUrl" :src="instance.serverErrorImageUrl" draggable="false" :class="$style.img"/> - <svg v-else-if="type === 'error'" :class="$style.icon" viewBox="0 0 128 128" style="stroke-linecap:round;stroke-linejoin:round;"> - <g transform="matrix(0.707107,0.707107,-0.636396,0.636396,62.0201,-24.5298)"> - <path d="M64,94.667L64,41.333" style="fill:none;stroke:currentColor;stroke-width:8.41px;"/> - </g> - <g transform="matrix(0.707107,-0.707107,0.636396,0.636396,-24.5298,65.9799)"> - <path d="M64,94.667L64,41.333" style="fill:none;stroke:currentColor;stroke-width:8.41px;"/> - </g> - <g transform="matrix(0.875,0,0,0.875,8,8)"> - <circle cx="64" cy="64" r="64" style="fill:none;stroke:currentColor;stroke-width:9.14px;"/> - </g> - </svg> + <MkSystemIcon v-else-if="type === 'error'" type="error" :class="$style.icon"/> <div style="opacity: 0.7;">{{ props.text ?? (type === 'empty' ? i18n.ts.nothing : type === 'notFound' ? i18n.ts.notFound : type === 'error' ? i18n.ts.somethingHappened : null) }}</div> <slot></slot> @@ -66,18 +36,6 @@ const props = defineProps<{ position: relative; text-align: center; padding: 32px; - - &.error { - .icon { - color: var(--MI_THEME-error); - } - } - - &.warn { - .icon { - color: var(--MI_THEME-warn); - } - } } .img { @@ -91,6 +49,5 @@ const props = defineProps<{ width: 50px; height: 50px; margin: 0 auto; - color: var(--MI_THEME-accent); } </style> diff --git a/packages/frontend/src/components/global/MkSystemIcon.vue b/packages/frontend/src/components/global/MkSystemIcon.vue new file mode 100644 index 0000000000..20ce524e6d --- /dev/null +++ b/packages/frontend/src/components/global/MkSystemIcon.vue @@ -0,0 +1,76 @@ +<!-- +SPDX-FileCopyrightText: syuilo and misskey-project +SPDX-License-Identifier: AGPL-3.0-only +--> + +<template> +<svg v-if="type === 'info'" :class="[$style.icon, $style.info]" viewBox="0 0 128 128"> + <path d="M64,92L64,56" style="--l:40;" :class="[$style.line, $style.anim]"/> + <circle cx="64" cy="36" r="4" :class="[$style.fill]"/> + <circle cx="64" cy="64" r="56" style="--l:400;" :class="[$style.line, $style.anim]"/> +</svg> +<svg v-else-if="type === 'question'" :class="[$style.icon, $style.question]" viewBox="0 0 128 128"> + <path d="M63.991,76L64,68C73.333,68 80,60.333 80,52C80,43.667 73.336,36 64,36C54.664,36 47.983,43.664 47.983,52" style="--l:85;" :class="[$style.line, $style.anim]"/> + <circle cx="64" cy="92" r="4" :class="[$style.fill]"/> + <circle cx="64" cy="64" r="56" style="--l:400;" :class="[$style.line, $style.anim]"/> +</svg> +<svg v-else-if="type === 'error'" :class="[$style.icon, $style.error]" viewBox="0 0 128 128"> + <path d="M47.029,47.029L80.971,80.971" style="--l:55;--duration:0.3s;" :class="[$style.line, $style.anim]"/> + <path d="M80.971,47.029L47.029,80.971" style="--l:55;--duration:0.3s;--delay:0.2s;" :class="[$style.line, $style.anim]"/> + <circle cx="64" cy="64" r="56" style="--l:400;" :class="[$style.line, $style.anim]"/> +</svg> +</template> + +<script lang="ts" setup> +import {} from 'vue'; + +const props = defineProps<{ + type: 'info' | 'question' | 'warn' | 'error'; +}>(); +</script> + +<style lang="scss" module> +.icon { + color: var(--MI_THEME-accent); + stroke-linecap: round; + stroke-linejoin: round; + + &.question { + color: var(--MI_THEME-warn); + } + + &.warn { + color: var(--MI_THEME-warn); + } + + &.error { + color: var(--MI_THEME-error); + } +} + +.line { + fill: none; + stroke: currentColor; + stroke-width: 8px; +} + +.fill { + fill: currentColor; +} + +.anim { + stroke-dasharray: var(--l); + stroke-dashoffset: var(--l); + animation: line-animation var(--duration, 0.5s) ease-out 1 forwards; + animation-delay: var(--delay, 0s); +} + +@keyframes line-animation { + 0% { + stroke-dashoffset: var(--l); + } + 100% { + stroke-dashoffset: 0; + } +} +</style> diff --git a/packages/frontend/src/components/index.ts b/packages/frontend/src/components/index.ts index 33d3532c1d..9981772ae8 100644 --- a/packages/frontend/src/components/index.ts +++ b/packages/frontend/src/components/index.ts @@ -25,6 +25,7 @@ import MkPageHeader from './global/MkPageHeader.vue'; import MkStickyContainer from './global/MkStickyContainer.vue'; import MkLazy from './global/MkLazy.vue'; import MkResult from './global/MkResult.vue'; +import MkSystemIcon from './global/MkSystemIcon.vue'; import PageWithHeader from './global/PageWithHeader.vue'; import PageWithAnimBg from './global/PageWithAnimBg.vue'; import SearchMarker from './global/SearchMarker.vue'; @@ -63,6 +64,7 @@ export const components = { MkStickyContainer: MkStickyContainer, MkLazy: MkLazy, MkResult: MkResult, + MkSystemIcon: MkSystemIcon, PageWithHeader: PageWithHeader, PageWithAnimBg: PageWithAnimBg, SearchMarker: SearchMarker, @@ -95,6 +97,7 @@ declare module '@vue/runtime-core' { MkStickyContainer: typeof MkStickyContainer; MkLazy: typeof MkLazy; MkResult: typeof MkResult; + MkSystemIcon: typeof MkSystemIcon; PageWithHeader: typeof PageWithHeader; PageWithAnimBg: typeof PageWithAnimBg; SearchMarker: typeof SearchMarker; |