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

clean up error ui view#247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intomasterfromui/error-view
Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionsweb-app/src/components/Button/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,7 @@ interface Props {
onClick?: () => void
size?: 'small' | 'medium' | 'large'
iconSize?: 'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl'
warning?: boolean
}

const Button = (props: Props) => (
Expand All@@ -19,6 +20,7 @@ const Button = (props: Props) => (
style={props.style}
size={props.size}
iconSize={props.iconSize}
warning={props.warning}
>
{props.children}
</AlifdButton>
Expand Down
42 changes: 32 additions & 10 deletionsweb-app/src/components/Error/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,12 +7,28 @@ import Button from '../../components/Button'

const styles = {
container: {
color: '#D8000C',
backgroundColor: '#FFBABA',
display: 'flex' as 'flex',
flexDirection: 'column' as 'column',
justifyContent: 'center' as 'center',
alignItems: 'center' as 'center',
border: '0.5rem solid #FFBABA',
padding: '1rem',
width: '100%',
height: '100%',
},
content: {
textAlign: 'center' as 'center',
color: 'rgb(40, 40, 40);',
},
options: {
display: 'flex' as 'flex',
flexDirection: 'column' as 'column',
alignItems: 'center',
},
button: {
margin: '0.5rem',
width: '10rem',
},
}

interface Props {
Expand All@@ -34,15 +50,21 @@ const ErrorMarkdown = ({ error, send }: Props) => {

return (
<div css={styles.container}>
<h1>Error</h1>
<Markdown>{error.message}</Markdown>
<h1>Oops!</h1>
<div css={styles.content}>
<Markdown>{error.message}</Markdown>
</div>
<br />
<br />
{/* Actions */}
{error.actions &&
error.actions.map((a) => (
<Button type="secondary" onClick={() => send({ type: a.transition })}>
{a.label}
</Button>
))}
<div css={styles.options}>
{error.actions &&
error.actions.map((a) => (
<Button type="normal" warning style={styles.button} onClick={() => send({ type: a.transition })}>
{a.label}
</Button>
))}
</div>
</div>
)
}
Expand Down
20 changes: 20 additions & 0 deletionsweb-app/stories/Error.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
import * as E from '../../typings/error'
import { action } from '@storybook/addon-actions'
import { storiesOf } from '@storybook/react'
import React from 'react'
import ErrorView from '../src/components/Error'
import SideBarDecorator from './utils/SideBarDecorator'

storiesOf('Error', module)
.addDecorator(SideBarDecorator)
.add('Error', () => {
const error: E.ErrorMessage = {
type: 'UnknownError',
message: '### Message summary\n\nSome message about what went wrong under here',
actions: [
{ label: 'First', transition: 'FIRST' },
{ label: 'Second', transition: 'SECOND' },
],
}
return <ErrorView error={error} send={action('send')} />
})

[8]ページ先頭

©2009-2025 Movatter.jp