File tree Expand file tree Collapse file tree 3 files changed +52
-5
lines changed
Expand file tree Collapse file tree 3 files changed +52
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export default function HomePage() {
1919
2020 < div class = "flex items-center gap-x-3" >
2121 < button
22- class = "flex items-center gap-x-2 rounded-full bg-neutral-900 px-6 py-3 active:scale-95"
22+ class = "flex items-center gap-x-2 rounded-full bg-neutral-900 px-6 py-3 transition active:scale-95"
2323 onClick = { ( ) => {
2424 cycle ( ) ;
2525 } }
@@ -31,7 +31,7 @@ export default function HomePage() {
3131 < a
3232 href = "https://github.com/blankeos/solid-number-flow"
3333 target = "_blank"
34- class = "rounded-full border border-white p-2 hover:bg-neutral-50/20 active:scale-95"
34+ class = "rounded-full border border-white p-2 transition hover:bg-neutral-50/20 active:scale-95"
3535 >
3636 < IconGithub class = "h-5 w-5" />
3737 </ a >
@@ -61,7 +61,7 @@ export default function HomePage() {
6161 ) ;
6262}
6363
64- import { createEffect , createMemo , createSignal } from 'solid-js' ;
64+ import { createMemo , createSignal } from 'solid-js' ;
6565import { IconShuffle } from '../icons/shuffle' ;
6666import { IconSolidJS } from '../icons/solidjs' ;
6767import { Markdown } from '../markdown' ;
Original file line number Diff line number Diff line change 1+ import { createSignal , onMount } from 'solid-js' ;
2+ import NumberFlow from 'src' ;
3+
4+ export default function Page ( ) {
5+ const [ value1 , setValue1 ] = createSignal ( 123 ) ;
6+ const [ value2 , setValue2 ] = createSignal ( 0 ) ;
7+ const [ value3 , setValue3 ] = createSignal ( 123 ) ;
8+ const [ value4 , setValue4 ] = createSignal ( 0 ) ;
9+
10+ onMount ( ( ) => {
11+ setTimeout ( ( ) => {
12+ setValue1 ( 500 ) ;
13+ } , 500 ) ;
14+ setTimeout ( ( ) => {
15+ setValue2 ( 1.42 ) ;
16+ } , 800 ) ;
17+ setTimeout ( ( ) => {
18+ setValue3 ( 7298 ) ;
19+ } , 1000 ) ;
20+ setTimeout ( ( ) => {
21+ setValue4 ( 1_500_540 ) ;
22+ } , 1500 ) ;
23+ } ) ;
24+
25+ return (
26+ < div class = "flex min-h-screen flex-col items-center justify-center gap-y-3 bg-zinc-950 text-white" >
27+ < NumberFlow value = { value1 ( ) } locales = "en-US" />
28+ < NumberFlow
29+ value = { value2 ( ) }
30+ locales = "en-US"
31+ format = { {
32+ style : 'percent' ,
33+ } }
34+ />
35+ < NumberFlow value = { value3 ( ) } locales = "en-US" />
36+ < NumberFlow
37+ value = { value4 ( ) }
38+ locales = "en-US"
39+ format = { {
40+ style : 'currency' ,
41+ currency : 'USD' ,
42+ } }
43+ />
44+ < a href = "/" > Back /</ a >
45+ </ div >
46+ ) ;
47+ }
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export default function NumberFlow(props: NumberFlowProps) {
5454 ) ;
5555 const formatString = createMemo ( ( ) => ( props . format ? JSON . stringify ( props . format ) : '' ) ) ;
5656 const parts = createMemo ( ( ) => {
57- const formatter = ( formatters [ `${ localesString } :${ formatString } ` ] ??= new Intl . NumberFormat (
57+ const formatter = ( formatters [ `${ localesString ( ) } :${ formatString ( ) } ` ] ??= new Intl . NumberFormat (
5858 props . locales ,
5959 props . format ,
6060 ) ) ;
@@ -92,7 +92,7 @@ export default function NumberFlow(props: NumberFlowProps) {
9292 return (
9393 < Dynamic
9494 ref = { props . ref }
95- component = { ' number-flow' }
95+ component = " number-flow"
9696 class = { props . class }
9797 // https://docs.solidjs.com/reference/jsx-attributes/attr
9898 attr :data-will-change = { props . willChange ? '' : undefined }
You can’t perform that action at this time.
0 commit comments