mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-29 02:49:13 -04:00
refactor(ui): getting ride of naive ui buttons
This commit is contained in:
parent
df989e24b3
commit
c45bce36f9
44 changed files with 738 additions and 204 deletions
39
src/ui/c-link/c-link.theme.ts
Normal file
39
src/ui/c-link/c-link.theme.ts
Normal 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
49
src/ui/c-link/c-link.vue
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue