- Notifications
You must be signed in to change notification settings - Fork927
feat: add margins to pages#1217
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ComponentMeta, Story } from "@storybook/react" | ||
import React from "react" | ||
import { Margins } from "./Margins" | ||
export default { | ||
title: "components/Margins", | ||
component: Margins, | ||
} as ComponentMeta<typeof Margins> | ||
const Template: Story = (args) => ( | ||
<Margins {...args}> | ||
<div style={{ width: "100%", background: "lightgrey" }}>Here is some content that will not get too wide!</div> | ||
</Margins> | ||
) | ||
export const Example = Template.bind({}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { makeStyles } from "@material-ui/core/styles" | ||
import React from "react" | ||
import { maxWidth, sidePadding } from "../../theme/constants" | ||
const useStyles = makeStyles(() => ({ | ||
margins: { | ||
margin: "0 auto", | ||
maxWidth, | ||
padding: `0 ${sidePadding}`, | ||
flex: 1, | ||
}, | ||
})) | ||
export const Margins: React.FC = ({ children }) => { | ||
const styles = useStyles() | ||
return ( | ||
<div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Question: It's not clear to me why we need an outer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Yeah, I don't totally understand it, but the content gets horizontally squished without it. My guess is that it's needed as a buffer between the content and | ||
<div className={styles.margins}>{children}</div> | ||
</div> | ||
) | ||
} |