From a514a364ec5b6e2e34e7901ad51219d7be2aee86 Mon Sep 17 00:00:00 2001 From: MAZE Date: Thu, 8 Feb 2024 19:43:50 +0330 Subject: [PATCH] feat: add special button --- .../categories/donate/donate.module.css | 72 ------------------ src/components/categories/donate/donate.tsx | 8 +- src/components/source/source.module.css | 72 ------------------ src/components/source/source.tsx | 10 +-- src/components/special-button/index.ts | 1 + .../special-button/special-button.module.css | 74 +++++++++++++++++++ .../special-button/special-button.tsx | 26 +++++++ 7 files changed, 110 insertions(+), 153 deletions(-) create mode 100644 src/components/special-button/index.ts create mode 100644 src/components/special-button/special-button.module.css create mode 100644 src/components/special-button/special-button.tsx diff --git a/src/components/categories/donate/donate.module.css b/src/components/categories/donate/donate.module.css index db85208..07c51df 100644 --- a/src/components/categories/donate/donate.module.css +++ b/src/components/categories/donate/donate.module.css @@ -40,78 +40,6 @@ } .button { - position: relative; - z-index: 1; - display: flex; - align-items: center; - justify-content: center; - width: max-content; - height: 40px; - padding: 0 20px; margin: 16px auto 0; - overflow: hidden; - font-size: var(--font-xsm); - font-weight: 500; - color: var(--color-neutral-subtle); - text-decoration: none; - cursor: pointer; - background-color: var(--color-neutral-200); - border: none; - border-radius: 50px; - transition: 0.2s; - - &::after { - position: absolute; - top: 1px; - left: 1px; - z-index: -1; - width: calc(100% - 2px); - height: calc(100% - 2px); - content: ''; - background-color: var(--color-neutral-50); - border-radius: 100px; - transition: inherit; - } - - &::before { - position: absolute; - top: 50%; - left: 50%; - z-index: -2; - width: 150%; - aspect-ratio: 1 / 1; - content: ''; - background-image: conic-gradient( - transparent, - transparent, - var(--color-neutral-400), - transparent, - transparent, - transparent, - transparent, - var(--color-neutral-400), - transparent, - transparent - ); - transform: translate(-50%, -50%); - animation-name: shine; - animation-duration: 6s; - animation-timing-function: linear; - animation-iteration-count: infinite; - } - - &:hover::after { - background-color: var(--color-neutral-100); - } - } -} - -@keyframes shine { - 0% { - transform: translate(-50%, -50%) rotate(90deg); - } - - 100% { - transform: translate(-50%, -50%) rotate(450deg); } } diff --git a/src/components/categories/donate/donate.tsx b/src/components/categories/donate/donate.tsx index 8f0684e..a5c3ac5 100644 --- a/src/components/categories/donate/donate.tsx +++ b/src/components/categories/donate/donate.tsx @@ -1,5 +1,7 @@ import { FaCoffee } from 'react-icons/fa/index'; +import { SpecialButton } from '@/components/special-button'; + import styles from './donate.module.css'; export function Donate() { @@ -14,14 +16,12 @@ export function Donate() {

Support Me

Help me keep Moodist ad-free.

- Donate Today - + ); } diff --git a/src/components/source/source.module.css b/src/components/source/source.module.css index 66300a8..48b360f 100644 --- a/src/components/source/source.module.css +++ b/src/components/source/source.module.css @@ -63,78 +63,6 @@ } .button { - position: relative; - z-index: 1; - display: flex; - align-items: center; - justify-content: center; - width: max-content; - height: 40px; - padding: 0 20px; margin: 16px auto 0; - overflow: hidden; - font-size: var(--font-xsm); - font-weight: 500; - color: var(--color-neutral-subtle); - text-decoration: none; - cursor: pointer; - background-color: var(--color-neutral-200); - border: none; - border-radius: 50px; - transition: 0.2s; - - &::after { - position: absolute; - top: 1px; - left: 1px; - z-index: -1; - width: calc(100% - 2px); - height: calc(100% - 2px); - content: ''; - background-color: var(--color-neutral-50); - border-radius: 100px; - transition: inherit; - } - - &::before { - position: absolute; - top: 50%; - left: 50%; - z-index: -2; - width: 150%; - aspect-ratio: 1 / 1; - content: ''; - background-image: conic-gradient( - transparent, - transparent, - var(--color-neutral-400), - transparent, - transparent, - transparent, - transparent, - var(--color-neutral-400), - transparent, - transparent - ); - transform: translate(-50%, -50%); - animation-name: shine; - animation-duration: 6s; - animation-timing-function: linear; - animation-iteration-count: infinite; - } - - &:hover::after { - background-color: var(--color-neutral-100); - } - } -} - -@keyframes shine { - 0% { - transform: translate(-50%, -50%) rotate(90deg); - } - - 100% { - transform: translate(-50%, -50%) rotate(450deg); } } diff --git a/src/components/source/source.tsx b/src/components/source/source.tsx index 14cc974..65e7b8d 100644 --- a/src/components/source/source.tsx +++ b/src/components/source/source.tsx @@ -1,7 +1,9 @@ import { FaGithub } from 'react-icons/fa/index'; +import { Container } from '@/components/container'; +import { SpecialButton } from '@/components/special-button'; + import styles from './source.module.css'; -import { Container } from '../container'; export function Source() { return ( @@ -17,14 +19,12 @@ export function Source() {

Open Source

Moodist is free and open-source!

- Source Code - + diff --git a/src/components/special-button/index.ts b/src/components/special-button/index.ts new file mode 100644 index 0000000..55d2837 --- /dev/null +++ b/src/components/special-button/index.ts @@ -0,0 +1 @@ +export { SpecialButton } from './special-button'; diff --git a/src/components/special-button/special-button.module.css b/src/components/special-button/special-button.module.css new file mode 100644 index 0000000..f493f63 --- /dev/null +++ b/src/components/special-button/special-button.module.css @@ -0,0 +1,74 @@ +.button { + position: relative; + z-index: 1; + display: flex; + align-items: center; + justify-content: center; + width: max-content; + height: 40px; + padding: 0 20px; + overflow: hidden; + font-size: var(--font-xsm); + font-weight: 500; + color: var(--color-neutral-subtle); + text-decoration: none; + cursor: pointer; + background-color: var(--color-neutral-200); + border: none; + border-radius: 50px; + transition: 0.2s; + + &::after { + position: absolute; + top: 1px; + left: 1px; + z-index: -1; + width: calc(100% - 2px); + height: calc(100% - 2px); + content: ''; + background-color: var(--color-neutral-50); + border-radius: 100px; + transition: inherit; + } + + &::before { + position: absolute; + top: 50%; + left: 50%; + z-index: -2; + width: 150%; + aspect-ratio: 1 / 1; + content: ''; + background-image: conic-gradient( + transparent, + transparent, + var(--color-neutral-400), + transparent, + transparent, + transparent, + transparent, + var(--color-neutral-400), + transparent, + transparent + ); + transform: translate(-50%, -50%); + animation-name: shine; + animation-duration: 6s; + animation-timing-function: linear; + animation-iteration-count: infinite; + } + + &:hover::after { + background-color: var(--color-neutral-100); + } +} + +@keyframes shine { + 0% { + transform: translate(-50%, -50%) rotate(90deg); + } + + 100% { + transform: translate(-50%, -50%) rotate(450deg); + } +} diff --git a/src/components/special-button/special-button.tsx b/src/components/special-button/special-button.tsx new file mode 100644 index 0000000..1c660ec --- /dev/null +++ b/src/components/special-button/special-button.tsx @@ -0,0 +1,26 @@ +import { cn } from '@/helpers/styles'; + +import styles from './special-button.module.css'; + +interface SpecialButtonProps { + children: React.ReactNode; + className?: string; + href: string; +} + +export function SpecialButton({ + children, + className, + href, +}: SpecialButtonProps) { + return ( + + {children} + + ); +}