Skip to content

Commit

Permalink
feat(stats): add animation to graph
Browse files Browse the repository at this point in the history
  • Loading branch information
believer committed Dec 23, 2023
1 parent 4fe1fd5 commit a222b5a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
17 changes: 9 additions & 8 deletions components/graphs.templ
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ templ Graph(data []types.Bar, title string) {
<svg role="img" viewBox="0 0 536 200">
for _, bar := range data {
<g
class="fill-neutral-100 [@media(any-hover:hover){&amp;:hover}]:fill-neutral-200 dark:fill-neutral-800 dark:[@media(any-hover:hover){&amp;:hover}]:fill-neutral-700"
_="on mouseenter add .opacity-100 to &lt;text /&gt; in me
on mouseleave remove .opacity-100 from &lt;text /&gt; in me
class="fill-neutral-100 [@media(any-hover:hover){&:hover}]:fill-neutral-200 dark:fill-neutral-800 dark:[@media(any-hover:hover){&:hover}]:fill-neutral-700"
_="on mouseenter add .opacity-100 to <text /> in me
on mouseleave remove .opacity-100 from <text /> in me
on touchstart
add .opacity-100 to &lt;text /&gt; in me
add .fill-neutral-200 .dark:fill-neutral-700 to &lt;rect /&gt; in me
add .opacity-100 to <text /> in me
add .fill-neutral-200 .dark:fill-neutral-700 to <rect /> in me
on touchend wait 1s then
remove .fill-neutral-200 .dark:fill-neutral-700 from &lt;rect /&gt; in me
remove .opacity-100 from &lt;text /&gt; in me
remove .fill-neutral-200 .dark:fill-neutral-700 from <rect /> in me
remove .opacity-100 from <text /> in me
end"
>
<rect
class="stroke-neutral-400 dark:stroke-neutral-600"
class="stroke-neutral-400 dark:stroke-neutral-600 transition-transform delay-200 duration-1000 scale-y-0 origin-[center_180px]"
_="init add .scale-y-100 to me"
width={ strconv.Itoa(bar.BarWidth) }
height={ strconv.Itoa(bar.BarHeight) }
stroke-dasharray="4 2"
Expand Down
2 changes: 1 addition & 1 deletion components/graphs_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a222b5a

Please sign in to comment.