1- import { Box , Icon , Text , ThemeKeys } from "@prismicio/editor-ui" ;
1+ import {
2+ BlankSlate ,
3+ BlankSlateActions ,
4+ BlankSlateDescription ,
5+ BlankSlateIcon ,
6+ BlankSlateTitle ,
7+ Box ,
8+ ThemeKeys ,
9+ } from "@prismicio/editor-ui" ;
210import { ReactNode } from "react" ;
311
412type EmptyViewProps = {
@@ -7,13 +15,25 @@ type EmptyViewProps = {
715 // TODO: Replace prismic with github icon when available
816 icon : "prismic" | "alert" | "logout" ;
917 color ?: "purple" | "tomato" ;
10- children ?: ReactNode ;
18+ actions ?: ReactNode ;
1119} ;
1220
1321export function EmptyView ( props : EmptyViewProps ) {
14- const { title, description, icon, children , color = "purple" } = props ;
22+ const { title, description, icon, actions , color = "purple" } = props ;
1523
16- const colors = getColors ( color ) ;
24+ let iconColor : ThemeKeys < "color" > ;
25+ let iconBackgroundColor : ThemeKeys < "color" > ;
26+
27+ switch ( color ) {
28+ case "purple" :
29+ iconColor = "purple11" ;
30+ iconBackgroundColor = "purple3" ;
31+ break ;
32+ case "tomato" :
33+ iconColor = "tomato11" ;
34+ iconBackgroundColor = "tomato3" ;
35+ break ;
36+ }
1737
1838 return (
1939 < Box
@@ -23,50 +43,20 @@ export function EmptyView(props: EmptyViewProps) {
2343 gap = { 16 }
2444 flexGrow = { 1 }
2545 >
26- < Box
27- flexDirection = "column"
28- justifyContent = "center"
29- alignItems = "center"
30- gap = { 8 }
31- maxWidth = { 324 }
32- >
33- < Box
34- borderRadius = "100%"
35- backgroundColor = { colors . iconBackgroundColor }
36- padding = { 8 }
37- >
38- < Icon name = { icon } size = "small" color = { colors . iconColor } />
39- </ Box >
40- < Box flexDirection = "column" alignItems = "center" >
41- < Text variant = "bold" align = "center" >
42- { title }
43- </ Text >
44- { description !== undefined && (
45- < Text align = "center" color = "grey11" >
46- { description }
47- </ Text >
48- ) }
49- </ Box >
50- </ Box >
51- { children }
46+ < BlankSlate >
47+ < BlankSlateIcon
48+ lineColor = { iconColor }
49+ backgroundColor = { iconBackgroundColor }
50+ name = { icon }
51+ />
52+ < BlankSlateTitle size = "medium" > { title } </ BlankSlateTitle >
53+ { description !== undefined && (
54+ < BlankSlateDescription > { description } </ BlankSlateDescription >
55+ ) }
56+ { actions !== undefined && (
57+ < BlankSlateActions > { actions } </ BlankSlateActions >
58+ ) }
59+ </ BlankSlate >
5260 </ Box >
5361 ) ;
5462}
55-
56- function getColors ( color : "purple" | "tomato" ) : {
57- iconBackgroundColor : ThemeKeys < "color" > ;
58- iconColor : ThemeKeys < "color" > ;
59- } {
60- switch ( color ) {
61- case "purple" :
62- return {
63- iconBackgroundColor : "purple3" ,
64- iconColor : "purple11" ,
65- } ;
66- case "tomato" :
67- return {
68- iconBackgroundColor : "tomato3" ,
69- iconColor : "tomato11" ,
70- } ;
71- }
72- }
0 commit comments