Skip to content

Commit

Permalink
feat: animated border bage
Browse files Browse the repository at this point in the history
  • Loading branch information
jamerrq committed Mar 23, 2024
1 parent 337298e commit 00a0ec2
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 8 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"prettier": "^3.1.1",
"prettier-config-standard": "^7.0.0",
"prettier-plugin-astro": "^0.12.3",
"prettier-plugin-tailwindcss": "^0.5.12",
"sass": "^1.69.7",
"tailwindcss-debug-screens": "^2.2.1"
}
Expand Down
56 changes: 51 additions & 5 deletions src/components/badges/badge.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,55 @@
<div class='xl:absolute top-2 right-2 animate-slide-in-top'>
<span
class='relative flex overflow-hidden rounded p-[1.25px] shadow shadow-black'
>
<style>
.badge {
--timing: linear(0, 0.3, 0.75, 1);

padding: 0.5rem 1rem;
font-size: 0.9rem;

border-image-source: conic-gradient(
from var(--a),
yellowgreen,
green,
lightgreen
);

border-radius: 5px;

border-image-slice: 0.9 1 1 1;
border-image-width: 0.15rem;

animation: move 1s infinite var(--timing);

&.fill {
border-image-slice: 1 1 1 1 fill;
}

/* box-shadow: 5px 5px 0 #0006; */

&:active {
transform: translate(5px, 5px);
box-shadow: none;
}
}

@keyframes move {
from {
--a: 0deg;
}
to {
--a: 360deg;
}
}

@property --a {
syntax: '<angle>';
inherits: true;
initial-value: 0deg;
}
</style>
<div class='xl:absolute top-2 right-2 animate-slide-in-top rounded'>
<span class='relative flex overflow-hidden rounded shadow shadow-black'>
<div
class='flex items-center h-full w-full cursor-pointer justify-center rounded px-3 py-1 text-sm font-bold text-slate-900 bg-emerald-500 backdrop-blur-3xl shadow shadow-black'
class='flex items-center h-full w-full cursor-pointer justify-center rounded px-3 py-1 text-sm font-bold text-slate-900 bg-emerald-500 backdrop-blur-3xl shadow shadow-black dark:shadow-gray-300 badge'
>
<slot />
</div>
Expand Down
9 changes: 9 additions & 0 deletions src/components/main/about-me-card.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
import OpenToWork from '@components/badges/open-to-work.astro'
import Box from '@components/boxes/box.astro'
import Dice from '@icons/dice.astro'
interface Props {
lang: string
}
Expand Down Expand Up @@ -62,5 +63,13 @@ const { lang = 'en' }: Props = Astro.props
</p>
</li>
</ul>
<a
href='/games'
title='games section'
aria-label='games section'
class='animate-vertical-bounce animate-iteration-count-thrice animate-delay-500 hover:animate-iteration-count-infinite'
>
<Dice />
</a>
</div>
</Box>
4 changes: 2 additions & 2 deletions src/components/main/title.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import BitwiseLiminal from '@movies/bitwise-liminal.astro'
---

<div
class='row-span-2 xl:col-span-2 title bg-transparent text-emerald-400 p-2 rounded-sm w-full h-full flex items-center flex-row animate-blurred-fade-in relative'
class='row-span-2 xl:col-span-2 title bg-transparent text-emerald-400 p-2 rounded w-full h-full flex items-center flex-row animate-blurred-fade-in relative'
>
<div class='flex flex-col gap-1 animate-fade-in z-10'>
<a href={lang !== 'en' ? '/' : 'es'}>
Expand All @@ -25,7 +25,7 @@ import BitwiseLiminal from '@movies/bitwise-liminal.astro'
</span>
</div>
<div
class='fixed -z-10 top-0 left-0 origin-top-left w-full xl:flex place-content-center flex overflow-hidden h-full bg-opacity-10'
class='fixed -z-10 top-0 left-0 origin-top-left w-full xl:flex place-content-center flex overflow-hidden h-full bg-opacity-10 rounded'
id='animation-container'
>
<BitwiseLiminal />
Expand Down
50 changes: 50 additions & 0 deletions src/pages/board.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,56 @@ import Buttons from '@components/main/buttons.astro'
<main class='flex flex-col w-[100dvw] h-[100dvh]'></main>
<div class='absolute top-1 w-full mx-auto'>
<Buttons />
<style>
button {
--timing: linear(0, 0.3, 0.75, 1);

font-family: Jost, sans-serif;
font-size: 1rem;

padding: 1rem 2rem;
background: none;
color: #fff;

border-image-source: conic-gradient(
from var(--a),
indigo,
purple,
hotpink
);
border-image-slice: 1 1 1 1;
border-image-width: 0.25rem;

animation: move 1s infinite var(--timing);

&.fill {
border-image-slice: 1 1 1 1 fill;
}

box-shadow: 5px 5px 0 #0006;

&:active {
transform: translate(5px, 5px);
box-shadow: none;
}
}

@keyframes move {
from {
--a: 0deg;
}
to {
--a: 360deg;
}
}

@property --a {
syntax: '<angle>';
inherits: true;
initial-value: 0deg;
}
</style>
<button>A</button>
</div>
<Footer />
</Layout>
3 changes: 2 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export default {
},
plugins: [
require('tailwindcss-debug-screens'),
require('@midudev/tailwind-animations')
require('@midudev/tailwind-animations'),
'prettier-plugin-tailwindcss'
],
safelist: [
'fill-[#BC52EE]',
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
],
"@media/*": [
"src/media/*"
],
"@icons/*": [
"src/components/icons/*"
]
},
"jsx": "preserve",
Expand Down

0 comments on commit 00a0ec2

Please sign in to comment.