Skip to content

Commit 88c362d

Browse files
refactor(site): Refactor error state (#7313)
1 parent e747aad commit 88c362d

File tree

5 files changed

+206
-168
lines changed

5 files changed

+206
-168
lines changed

site/src/components/Margins/Margins.tsx

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import { FC } from "react"
3+
import { combineClasses } from "utils/combineClasses"
34
import {
45
containerWidth,
56
containerWidthMedium,
@@ -24,14 +25,15 @@ const useStyles = makeStyles(() => ({
2425
},
2526
}))
2627

27-
interface MarginsProps {
28-
size?: Size
29-
}
30-
31-
export const Margins: FC<React.PropsWithChildren<MarginsProps>> = ({
32-
children,
28+
export const Margins: FC<JSX.IntrinsicElements["div"] & { size?: Size }> = ({
3329
size = "regular",
30+
...divProps
3431
}) => {
3532
const styles = useStyles({ maxWidth: widthBySize[size] })
36-
return <div className={styles.margins}>{children}</div>
33+
return (
34+
<div
35+
{...divProps}
36+
className={combineClasses([styles.margins, divProps.className])}
37+
/>
38+
)
3739
}

site/src/components/RuntimeErrorState/RuntimeErrorState.stories.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import { ComponentMeta, Story } from "@storybook/react"
1+
import { Story } from "@storybook/react"
22
import { RuntimeErrorState, RuntimeErrorStateProps } from "./RuntimeErrorState"
33

44
const error = new Error("An error occurred")
55

66
export default {
77
title: "components/RuntimeErrorState",
88
component: RuntimeErrorState,
9-
argTypes: {
10-
error: {
11-
defaultValue: error,
12-
},
9+
args: {
10+
error,
1311
},
14-
} as ComponentMeta<typeof RuntimeErrorState>
12+
}
1513

1614
const Template: Story<RuntimeErrorStateProps> = (args) => (
1715
<RuntimeErrorState {...args} />

site/src/components/RuntimeErrorState/RuntimeErrorState.test.tsx

-54
This file was deleted.

0 commit comments

Comments
 (0)