refactor(ui): getting ride of naive ui buttons

This commit is contained in:
Corentin Thomasset 2023-04-19 21:38:59 +02:00 committed by Corentin THOMASSET
parent df989e24b3
commit c45bce36f9
44 changed files with 738 additions and 204 deletions

View file

@ -0,0 +1,39 @@
import { defineThemes } from '../theme/theme.models';
import { appThemes } from '../theme/themes';
export const { useTheme } = defineThemes({
dark: {
default: {
textColor: appThemes.dark.primary.color,
hover: {
textColor: appThemes.dark.primary.colorHover,
},
pressed: {
textColor: appThemes.dark.primary.colorPressed,
},
outline: {
color: appThemes.dark.primary.color,
},
},
},
light: {
default: {
textColor: appThemes.light.primary.color,
hover: {
textColor: appThemes.light.primary.colorHover,
},
pressed: {
textColor: appThemes.light.primary.colorPressed,
},
outline: {
color: appThemes.light.primary.color,
},
},
},
});

49
src/ui/c-link/c-link.vue Normal file
View file

@ -0,0 +1,49 @@
<template>
<component :is="tag" :href="href ?? to" class="c-link" :to="to">
<slot />
</component>
</template>
<script lang="ts" setup>
import { RouterLink, type RouteLocationRaw } from 'vue-router';
import { useTheme } from './c-link.theme';
const props = defineProps<{
href?: string;
to?: RouteLocationRaw;
}>();
const { href, to } = toRefs(props);
const theme = useTheme();
const tag = computed(() => (href?.value ? 'a' : RouterLink));
</script>
<style lang="less" scoped>
.c-link {
line-height: inherit;
font-family: inherit;
font-size: inherit;
border: none;
cursor: pointer;
text-decoration: none;
font-weight: 400;
color: v-bind('theme.default.textColor');
border-radius: 4px;
transition: color cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
outline-offset: 1px;
&:hover {
color: v-bind('theme.default.hover.textColor');
}
&:active {
color: v-bind('theme.default.textColor');
}
&:focus {
color: v-bind('theme.default.outline.color');
}
}
</style>