55 Snackbar ,
66 TabPanel ,
77 __experimentalGrid as Grid ,
8- __experimentalSpacer as Spacer
8+ __experimentalSpacer as Spacer ,
99} from '@wordpress/components' ;
10- import { useEffect , useState } from " @wordpress/element" ;
10+ import { useEffect , useState } from ' @wordpress/element' ;
1111import { __ } from '@wordpress/i18n' ;
1212import style from './App.module.css' ;
1313import Icon from '../images/icon.svg' ;
@@ -17,127 +17,116 @@ import TabTwo from './Tab/TabTwo';
1717import TabThree from './Tab/TabThree' ;
1818
1919const App = ( { title } : { title : string } ) => {
20- const [ showAnnouncement , setShowAnnouncement ] = useState < boolean | null > ( null ) ;
20+ const [ showAnnouncement , setShowAnnouncement ] = useState < boolean | null > (
21+ null
22+ ) ;
2123 const [ error , setError ] = useState < string | null > ( null ) ;
2224 const [ success , setSuccess ] = useState < string | null > ( null ) ;
2325 const [ tab , setTab ] = useSearchParams ( 'tab' , 'tab-1' ) ;
2426
2527 useEffect ( ( ) => {
2628 setShowAnnouncement ( true ) ;
27- setError ( __ ( 'This is an example error message.' , 'wp-react-admin-page-example' ) ) ;
29+ setError (
30+ __ ( 'This is an example error message.' , 'wp-react-admin-page-example' )
31+ ) ;
2832 setSuccess ( __ ( 'Example success' , 'wp-react-admin-page-example' ) ) ;
2933 } , [ ] ) ;
3034
3135 return (
3236 < >
33- < TopBar
34- title = { title }
35- />
36- < Spacer marginY = { 12 } />
37- < Grid
38- columns = { 1 }
39- gap = { 12 }
40- className = { style . inner }
41- >
42- { showAnnouncement && (
37+ < TopBar title = { title } />
38+ < Spacer marginY = { 12 } />
39+ < Grid columns = { 1 } gap = { 12 } className = { style . inner } >
40+ { showAnnouncement && (
4341 < Notice
4442 status = "info"
45- onRemove = { ( ) => setShowAnnouncement ( null ) }
43+ onRemove = { ( ) => setShowAnnouncement ( null ) }
4644 actions = { [
4745 {
4846 label : __ ( 'Click me!' , 'wp-react-admin-page-example' ) ,
49- onClick : ( ) => setShowAnnouncement ( null )
47+ onClick : ( ) => setShowAnnouncement ( null ) ,
5048 } ,
5149 {
52- label : __ ( 'Or visit a link for more info' , 'wp-react-admin-page-example' ) ,
50+ label : __ (
51+ 'Or visit a link for more info' ,
52+ 'wp-react-admin-page-example'
53+ ) ,
5354 url : 'https://wordpress.org' ,
54- variant : 'link'
55- }
55+ variant : 'link' ,
56+ } ,
5657 ] }
5758 >
58- < h2 > { __ ( 'Announcement banner' , 'wp-react-admin-page-example' ) } </ h2 >
59- < p > Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</ p >
59+ < h2 > { __ ( 'Announcement banner' , 'wp-react-admin-page-example' ) } </ h2 >
60+ < p >
61+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
62+ nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam
63+ erat, sed diam voluptua.
64+ </ p >
6065 </ Notice >
61- ) }
66+ ) }
6267 < TabPanel
6368 activeClass = "is-active"
64- onSelect = { setTab }
65- initialTabName = { tab }
66- className = { style . mainNav }
67- tabs = { [
69+ onSelect = { setTab }
70+ initialTabName = { tab }
71+ className = { style . mainNav }
72+ tabs = { [
6873 {
6974 name : 'tab-1' ,
7075 title : __ ( 'Tab 1' , 'wp-react-admin-page-example' ) ,
71- component : TabOne
76+ component : TabOne ,
7277 } ,
7378 {
7479 name : 'tab-2' ,
7580 title : __ ( 'Tab 2' , 'wp-react-admin-page-example' ) ,
76- component : TabTwo
81+ component : TabTwo ,
7782 } ,
7883 {
7984 name : 'tab-3' ,
8085 title : __ ( 'Tab 3' , 'wp-react-admin-page-example' ) ,
81- component : TabThree
86+ component : TabThree ,
8287 } ,
83- ] }
88+ ] }
8489 >
85- { ( tab ) => {
90+ { ( tab ) => {
8691 const TabComponent = tab . component ;
8792 return (
8893 < >
89- < Spacer marginY = { 12 } />
90- < Grid
91- columns = { 1 }
92- gap = { 12 }
93- >
94- { error && (
95- < Notice
96- status = "error"
97- onRemove = { ( ) => setError ( null ) }
98- >
99- { error }
94+ < Spacer marginY = { 12 } />
95+ < Grid columns = { 1 } gap = { 12 } >
96+ { error && (
97+ < Notice status = "error" onRemove = { ( ) => setError ( null ) } >
98+ { error }
10099 </ Notice >
101- ) }
100+ ) }
102101 < TabComponent />
103102 </ Grid >
104103 </ >
105104 ) ;
106105 } }
107106 </ TabPanel >
108- < Spacer marginY = { 12 } />
107+ < Spacer marginY = { 12 } />
109108 </ Grid >
110- { success && (
111- < Snackbar
112- onRemove = { ( ) => setSuccess ( null ) }
113- className = { style . snackbar }
114- >
115- { success }
109+ { success && (
110+ < Snackbar onRemove = { ( ) => setSuccess ( null ) } className = { style . snackbar } >
111+ { success }
116112 </ Snackbar >
117- ) }
113+ ) }
118114 </ >
119115 ) ;
120- }
116+ } ;
121117
122118const TopBar = ( { title } : { title : string } ) => {
123119 return (
124- < Flex
125- gap = { 1 }
126- className = { style . topBar }
127- >
128- < Flex
129- justify = "start"
130- gap = { 1 }
131- >
132- < Icon
133- aria-hidden = "true"
134- focusable = "false"
135- />
136- < h1 > { title } </ h1 >
120+ < Flex gap = { 1 } className = { style . topBar } >
121+ < Flex justify = "start" gap = { 1 } >
122+ < Icon aria-hidden = "true" focusable = "false" />
123+ < h1 > { title } </ h1 >
137124 </ Flex >
138- < ExternalLink href = "https://google.com" > { __ ( 'Help' , 'wp-react-admin-page-example' ) } </ ExternalLink >
125+ < ExternalLink href = "https://google.com" >
126+ { __ ( 'Help' , 'wp-react-admin-page-example' ) }
127+ </ ExternalLink >
139128 </ Flex >
140129 ) ;
141130} ;
142131
143- export default App ;
132+ export default App ;
0 commit comments