Skip to content

Commit

Permalink
feat(ui): add shine effect on planned badge
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed May 29, 2023
1 parent e73dbbc commit d69daf6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/shared/components/post-list/post-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export function PostLink({ post, hideYear = false }: Props) {
<h2 className="text-xl font-bold text-neutral-700 dark:text-neutral-500">
{post.title}
</h2>
<span className="group-hover:animate-wiggle group-hover:animate-infinite">
<span className="relative overflow-hidden rounded-lg">
<span className="shine group-hover:animate-shine group-hover:animate-duration-[1.5s]" />
<PlannedBadge />
</span>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/styles/utilities.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@
@apply border border-red-600;
@apply bg-blue-500;
}

.shine {
@apply absolute top-0 left-0 h-full w-1/3 -translate-x-full -skew-x-20 bg-white/0 bg-gradient-to-r from-white/0 via-white/10 to-white/0 text-white/0;
}
}
11 changes: 10 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module.exports = {
darkMode: 'class',
theme: {
extend: {
skew: {
20: '20deg'
},
fontFamily: {
'chivo-mono': ['"Chivo Mono"', 'cursive']
},
Expand All @@ -18,7 +21,8 @@ module.exports = {
slideDown: 'slideDown 300ms cubic-bezier(0.87, 0, 0.13, 1)',
slideUp: 'slideUp 300ms cubic-bezier(0.87, 0, 0.13, 1)',
overlayShow: 'overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1)',
contentShow: 'contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1)'
contentShow: 'contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1)',
shine: 'shine 4s linear 0s forwards'
},
keyframes: {
typing: {
Expand Down Expand Up @@ -48,6 +52,11 @@ module.exports = {
contentShow: {
from: { opacity: 0, transform: 'translate(-50%, -48%) scale(0.96)' },
to: { opacity: 1, transform: 'translate(-50%, -50%) scale(1)' }
},
shine: {
'20%, 100%': {
transform: 'translateX(300%)'
}
}
}
}
Expand Down

0 comments on commit d69daf6

Please sign in to comment.