Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd18d3cf

Browse files
committed
clean up error ui view
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentcf6a7a5 commitd18d3cf

File tree

3 files changed

+54
-10
lines changed

3 files changed

+54
-10
lines changed

‎web-app/src/components/Button/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface Props {
99
onClick?:()=>void
1010
size?:'small'|'medium'|'large'
1111
iconSize?:'xxs'|'xs'|'small'|'medium'|'large'|'xl'|'xxl'|'xxxl'
12+
warning?:boolean
1213
}
1314

1415
constButton=(props:Props)=>(
@@ -19,6 +20,7 @@ const Button = (props: Props) => (
1920
style={props.style}
2021
size={props.size}
2122
iconSize={props.iconSize}
23+
warning={props.warning}
2224
>
2325
{props.children}
2426
</AlifdButton>

‎web-app/src/components/Error/index.tsx

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,28 @@ import Button from '../../components/Button'
77

88
conststyles={
99
container:{
10-
color:'#D8000C',
11-
backgroundColor:'#FFBABA',
10+
display:'flex'as'flex',
11+
flexDirection:'column'as'column',
12+
justifyContent:'center'as'center',
13+
alignItems:'center'as'center',
14+
border:'0.5rem solid #FFBABA',
1215
padding:'1rem',
1316
width:'100%',
1417
height:'100%',
1518
},
19+
content:{
20+
textAlign:'center'as'center',
21+
color:'rgb(40, 40, 40);',
22+
},
23+
options:{
24+
display:'flex'as'flex',
25+
flexDirection:'column'as'column',
26+
alignItems:'center',
27+
},
28+
button:{
29+
margin:'0.5rem',
30+
width:'10rem',
31+
},
1632
}
1733

1834
interfaceProps{
@@ -34,15 +50,21 @@ const ErrorMarkdown = ({ error, send }: Props) => {
3450

3551
return(
3652
<divcss={styles.container}>
37-
<h1>Error</h1>
38-
<Markdown>{error.message}</Markdown>
53+
<h1>Oops!</h1>
54+
<divcss={styles.content}>
55+
<Markdown>{error.message}</Markdown>
56+
</div>
57+
<br/>
58+
<br/>
3959
{/* Actions */}
40-
{error.actions&&
41-
error.actions.map((a)=>(
42-
<Buttontype="secondary"onClick={()=>send({type:a.transition})}>
43-
{a.label}
44-
</Button>
45-
))}
60+
<divcss={styles.options}>
61+
{error.actions&&
62+
error.actions.map((a)=>(
63+
<Buttontype="normal"warningstyle={styles.button}onClick={()=>send({type:a.transition})}>
64+
{a.label}
65+
</Button>
66+
))}
67+
</div>
4668
</div>
4769
)
4870
}

‎web-app/stories/Error.stories.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import*asEfrom'../../typings/error'
2+
import{action}from'@storybook/addon-actions'
3+
import{storiesOf}from'@storybook/react'
4+
importReactfrom'react'
5+
importErrorViewfrom'../src/components/Error'
6+
importSideBarDecoratorfrom'./utils/SideBarDecorator'
7+
8+
storiesOf('Error',module)
9+
.addDecorator(SideBarDecorator)
10+
.add('Error',()=>{
11+
consterror:E.ErrorMessage={
12+
type:'UnknownError',
13+
message:'### Message summary\n\nSome message about what went wrong under here',
14+
actions:[
15+
{label:'First',transition:'FIRST'},
16+
{label:'Second',transition:'SECOND'},
17+
],
18+
}
19+
return<ErrorViewerror={error}send={action('send')}/>
20+
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp