webui: add search info style.

This commit is contained in:
EstrellaXD
2023-09-02 11:30:32 +08:00
parent f204bcd6b6
commit 9460cf211d
4 changed files with 134 additions and 48 deletions

View File

@@ -20,8 +20,8 @@ export const Template: Story = {
template: '<ab-bangumi-card v-bind="args" />',
}),
args: {
poster: "images/Bangumi/202306/b56b49ea.jpg",
name: "魔法少女小圆",
poster: "/images/Bangumi/202306/b56b49ea.jpg",
name: "BanGDream",
season: 1,
}

View File

@@ -3,19 +3,22 @@ import {ErrorPicture, Write} from '@icon-park/vue-next';
withDefaults(
defineProps<{
type?: 'primary' | 'search' | 'mobile';
poster: string;
name: string;
season: number;
group: string;
group?: string;
}>(),
{}
{
type: 'search',
}
);
defineEmits(['click']);
</script>
<template>
<div w-150px is-btn @click="() => $emit('click')">
<div v-if="type === 'primary'" w-150px is-btn @click="() => $emit('click')">
<div rounded-4px overflow-hidden poster-shandow rel>
<div w-full h-210px>
<template v-if="poster !== ''">
@@ -58,16 +61,65 @@ defineEmits(['click']);
</div>
</div>
<div px-4px py-4px>
<div py-4px>
<div text-h3 truncate>{{ name }}</div>
<div flex space-x-4px>
<ab-tag
<ab-tag
:title="`Season ${season}`"
/>
<ab-tag
:title="group"
/>
/>
</div>
</div>
<div v-else-if="type === 'search'" w-480px rounded-12px p-4px shadow class="card-border">
<div
bg-white rounded-8px p-12px
fx-cer justify-between
space-x-16px>
<div w-400px space-x-16px fx-cer>
<div h-44px w-72px rounded-6px class="image-container">
<template v-if="poster !== ''">
<img :src="`https://mikanani.me${poster}`" alt="poster" w-full class="search-image"/>
</template>
<template v-else>
<div wh-full f-cer border="1 white">
<ErrorPicture theme="outline" size="24" fill="#333"/>
</div>
</template>
</div>
<div flex-col space-y-4px>
<div w-300px text-h3 truncate>{{ name }}</div>
<div flex space-x-8px>
<ab-tag
:title="`Season ${season}`"
/>
<ab-tag
v-if="group !== ''"
:title="group"
type="primary"
/>
</div>
</div>
</div>
<ab-add round="true" type="medium" @click="()=> $emit('click')"/>
</div>
</div>
</template>
<style>
.vertical-border {
border: 4px solid #EEE5F4;
border-radius: 12px;
}
.card-border {
background: #EEE5F4;
}
.image-container {
border-radius: 6px;
overflow: hidden;
}
.search-image {
transform: translateY(-25%);
}
</style>

View File

@@ -1,29 +1,55 @@
<script lang="ts" setup>
withDefaults(
const props = withDefaults(
defineProps<{
round?: boolean;
type?: 'large' | 'medium' | 'small';
}>(),
{
round: false,
type: 'large',
}
);
defineEmits(['click']);
const buttonSize = computed(() => {
switch (props.type) {
case 'large':
return 'wh-36px'
case 'medium':
return 'wh-24px';
case 'small':
return 'wh-12px';
}
});
const lineSize = computed(() => {
switch (props.type) {
case 'large':
return 'w-18px h-4px';
case 'medium':
return 'w-3px h-12px';
case 'small':
return 'w-2px h-6px';
}
});
</script>
<template>
<button
:rounded="round ? '1/2' : '8px'"
wh-36px
f-cer
rel
transition-colors
class="box"
:class="[`type-${type}`, buttonSize]"
@click="$emit('click')"
>
<div class="line" abs></div>
<div class="line" abs rotate-90></div>
<div
:class="[`type-${type}`, lineSize]"
class="line" abs/>
<div :class="[`type-${type}`, lineSize]" class="line" abs rotate-90></div>
</button>
</template>
@@ -45,8 +71,6 @@ $active: #8e8a9c;
}
.line {
width: 4px;
height: 18px;
border-radius: 1px;
background: #fff;
}

View File

@@ -1,6 +1,6 @@
<script lang="ts" setup>
withDefaults(
const props = withDefaults(
defineProps<{
type: 'primary' | 'warn' | 'inactive' | 'active' | 'notify';
title: string;
@@ -11,18 +11,24 @@ withDefaults(
}
);
const InnerStyle = computed(() => {
return `${props.type}-inner`;
});
</script>
<template>
<div class="round-label" :class="type">
{{ title }}
<div p-1px rounded-16px inline-flex :class="type">
<div bg-white rounded-12px px-8px text-10px :class="InnerStyle">
{{ title }}
</div>
</div>
</template>
<style lang="scss" scoped>
// border
$primary: #4e3c94;
$primary: linear-gradient(90.5deg, #492897 1.53%, #783674 96.48%);
$warn: #892F2F;
$inactive: #797979;
$active: #104931;
@@ -32,7 +38,7 @@ $notify: #F5C451;
$primary-inner: #EEE5F4;
$warn-inner: #FFDFDF;
$inactive-inner: #E0E0E0;
$active-inner:#E5F4E0;
$active-inner: #E5F4E0;
$notify-inner: #FFF4DB;
//font-color
@@ -42,45 +48,49 @@ $inactive-font: #3F3F3F;
$active-font: #4C6643;
$notify-font: #A76E18;
.round-label {
padding: 2px 12px;
font-size: 10px;
display: inline-flex;
flex-direction: column;
align-items: flex-start;
gap: 10px;
border-radius: 12px;
.primary {
background: $primary;
}
.primary {
border: 1px solid $primary;
background-color: $primary-inner;
color: $primary-font;
.primary-inner {
background: $primary-inner;
color: $primary-font;
}
.warn {
border: 1px solid $warn;
background-color: $warn-inner;
color: $warn-font;
background: $warn;
}
.warn-inner {
background: $warn-inner;
color: $warn-font;
}
.inactive {
border: 1px solid $inactive;
background-color: $inactive-inner;
color: $inactive-font;
background: $inactive;
}
.inactive-inner {
background: $inactive-inner;
color: $inactive-font;
}
.active {
border: 1px solid $active;
background-color: $active-inner;
color: $active-font;
background: $active;
}
.active-inner {
background: $active-inner;
color: $active-font;
}
.notify {
border: 1px solid $notify;
background-color: $notify-inner;
color: $notify-font;
background: $notify;
}
.notify-inner {
background: $notify-inner;
color: $notify-font;
}
</style>