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

Button changed #130

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 18 additions & 0 deletions assets/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
.newButton{
background:
linear-gradient(black, black) padding-box ,
linear-gradient(to right, #dc2626, #be185d) border-box;
@apply border-solid border-transparent border-[2.5px] px-4 py-2
}
.newButton:hover{
background:
linear-gradient(to right, #dc2626, #be185d) padding-box ,
linear-gradient(to right, #dc2626, #be185d) border-box;
@apply border-solid border-transparent border-[2.5px] px-4 py-2
}
}
14 changes: 5 additions & 9 deletions components/App/Button.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">

import type { RouteRecordRaw } from 'vue-router';

const STYLES = {
Expand All @@ -8,10 +9,7 @@ const STYLES = {
},
secondary: {
needsPseudo: true,
all: 'text-white uppercase font-semibold sm:font-bold group px-4 py-2 relative',
main: 'relative z-20',
before: 'absolute bg-gradient-to-r from-red-600 to-pink-700 top-0 left-0 w-full h-full z-10',
after: 'group-hover:hidden absolute top-0.5 left-0.5 bottom-0 right-0 w-[calc(100%-0.25rem)] h-[calc(100%-0.25rem)] z-10'
all:'text-white uppercase font-semibold sm:font-bold bg-gradient-to-r from-red-500 to-red-500',
}
} as const

Expand All @@ -35,14 +33,12 @@ const componentToRender = computed(() => props.to ? resolveComponent('AppLink')
<component :is="componentToRender" :type="to ? undefined : 'button'" :class="selectedLook.all" :to="to"
class="focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-pink-600 inline-block">
<template v-if="selectedLook.needsPseudo">
<span :class="selectedLook.before" />
<span :class="'main' in selectedLook && selectedLook.main">
<article :class="[selectedLook.main,'newButton']">
<slot />
</span>
<span :class="[selectedLook.after, secondaryAfterBg]" />
</article>
</template>
<template v-else>
<slot />
</template>
</component>
</template>
</template>
4 changes: 3 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ export default defineNuxtConfig({
}
}
}
}
},
cssPath: '~/assets/custom.css',
exposeConfig: true
},

devtools: {
Expand Down