File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 1
- import { useTimeout , useTranslate } from "ra-core" ;
1
+ import { Translate , useTimeout } from "ra-core" ;
2
2
import { Spinner } from "./spinner" ;
3
3
4
4
export const Loading = ( props : LoadingProps ) => {
@@ -9,7 +9,6 @@ export const Loading = (props: LoadingProps) => {
9
9
...rest
10
10
} = props ;
11
11
const oneSecondHasPassed = useTimeout ( delay ) ;
12
- const translate = useTranslate ( ) ;
13
12
return oneSecondHasPassed ? (
14
13
< div
15
14
className = { "flex flex-col justify-center items-center h-full" }
@@ -18,10 +17,10 @@ export const Loading = (props: LoadingProps) => {
18
17
< div className = { "text-center font-sans color-muted pt-1 pb-1" } >
19
18
< Spinner size = "large" className = "width-9 height-9" />
20
19
< h5 className = "mt-3 text-2xl text-secondary-foreground" >
21
- { translate ( loadingPrimary , { _ : loadingPrimary } ) }
20
+ < Translate i18nKey = { loadingPrimary } > { loadingPrimary } </ Translate >
22
21
</ h5 >
23
22
< p className = "text-primary" >
24
- { translate ( loadingSecondary , { _ : loadingSecondary } ) }
23
+ < Translate i18nKey = { loadingSecondary } > { loadingSecondary } </ Translate >
25
24
</ p >
26
25
</ div >
27
26
</ div >
Original file line number Diff line number Diff line change @@ -25,9 +25,15 @@ const StoryWrapper = ({
25
25
26
26
const i18nProvider = polyglotI18nProvider ( ( ) => englishMessages , "en" ) ;
27
27
28
- export const Basic = ( { theme } : { theme : "system" | "light" | "dark" } ) => (
28
+ export const Basic = ( {
29
+ theme,
30
+ delay,
31
+ } : {
32
+ theme : "system" | "light" | "dark" ;
33
+ delay ?: number ;
34
+ } ) => (
29
35
< StoryWrapper theme = { theme } >
30
- < Loading />
36
+ < Loading delay = { delay } />
31
37
</ StoryWrapper >
32
38
) ;
33
39
@@ -46,11 +52,17 @@ Basic.argTypes = {
46
52
} ,
47
53
} ;
48
54
49
- export const I18N = ( { theme } : { theme : "system" | "light" | "dark" } ) => {
55
+ export const I18N = ( {
56
+ theme,
57
+ delay,
58
+ } : {
59
+ theme : "system" | "light" | "dark" ;
60
+ delay ?: number ;
61
+ } ) => {
50
62
return (
51
63
< StoryWrapper theme = { theme } >
52
64
< I18nContextProvider value = { i18nProvider } >
53
- < Loading />
65
+ < Loading delay = { delay } />
54
66
</ I18nContextProvider >
55
67
</ StoryWrapper >
56
68
) ;
You can’t perform that action at this time.
0 commit comments