File tree 3 files changed +26
-2
lines changed
packages/sanity/src/structure
3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { Card , Stack , Text } from '@sanity/ui'
2
+
3
+ import { PaneLayout } from '../components'
4
+ import { LoadingPane } from '../panes'
5
+
6
+ export default function LoadingPaneStory ( ) {
7
+ return (
8
+ < Stack space = { 3 } >
9
+ < Card padding = { 4 } tone = "positive" >
10
+ < Text align = "center" >
11
+ Note: This is < em > intentionally</ em > not resolving. We're testing the loading pane!
12
+ </ Text >
13
+ </ Card >
14
+ < PaneLayout height = "fill" >
15
+ < LoadingPane paneKey = "loading" />
16
+ </ PaneLayout >
17
+ </ Stack >
18
+ )
19
+ }
Original file line number Diff line number Diff line change @@ -15,5 +15,10 @@ export default defineScope({
15
15
title : 'Document state' ,
16
16
component : lazy ( ( ) => import ( './DocumentStateStory' ) ) ,
17
17
} ,
18
+ {
19
+ name : 'loading-pane' ,
20
+ title : 'Loading pane' ,
21
+ component : lazy ( ( ) => import ( './LoadingPaneStory' ) ) ,
22
+ } ,
18
23
] ,
19
24
} )
Original file line number Diff line number Diff line change @@ -61,12 +61,12 @@ export const LoadingPane = memo((props: LoadingPaneProps) => {
61
61
62
62
const [ currentMessage , setCurrentMessage ] = useState < string | null > ( ( ) => {
63
63
if ( typeof resolvedMessage === 'string' ) return resolvedMessage
64
- return DEFAULT_MESSAGE_KEY
64
+ return t ( DEFAULT_MESSAGE_KEY )
65
65
} )
66
66
67
67
useEffect ( ( ) => {
68
68
if ( typeof resolvedMessage !== 'object' ) return undefined
69
- if ( typeof resolvedMessage . subscribe = == 'function' ) return undefined
69
+ if ( typeof resolvedMessage . subscribe ! == 'function' ) return undefined
70
70
71
71
const sub = resolvedMessage . subscribe ( ( message ) => {
72
72
setCurrentMessage ( 'messageKey' in message ? t ( message . messageKey ) : message . message )
You can’t perform that action at this time.
0 commit comments