This repository has been archived by the owner on Mar 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: adjust paddings in
Section
component (#3430)
- Loading branch information
Showing
55 changed files
with
3,683 additions
and
3,413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,41 @@ | ||
import cn from "classnames"; | ||
import React from "react"; | ||
import tw, { css, styled } from "twin.macro"; | ||
|
||
type SectionProps = { | ||
children: React.ReactNode; | ||
backgroundColor?: string; | ||
border?: boolean; | ||
className?: string; | ||
innerClassName?: string; | ||
}; | ||
|
||
const SectionWrapper = styled.div<{ backgroundColor?: string }>` | ||
${tw`w-full`} | ||
const SectionWrapper = styled.div<{ backgroundColor?: string; border?: boolean }>` | ||
${tw`w-full py-4 first:pt-8 last:pb-8`}; | ||
${({ backgroundColor }) => | ||
backgroundColor && | ||
css` | ||
& { | ||
background-color var(${backgroundColor}); | ||
background-color: var(${backgroundColor}); | ||
} | ||
`}; | ||
${({ border }) => | ||
border && [ | ||
tw`border-b border-theme-secondary-300 dark:border-theme-secondary-800`, | ||
css` | ||
&.hasBorder + & { | ||
${tw`pt-8`} | ||
} | ||
`, | ||
]}; | ||
${({ backgroundColor, border }) => (backgroundColor ? tw`py-8` : border ? tw`pb-8` : "")}; | ||
`; | ||
|
||
export const Section = ({ children, backgroundColor, className, innerClassName }: SectionProps) => ( | ||
<SectionWrapper backgroundColor={backgroundColor} className={className}> | ||
<div className={`container py-16 px-14 mx-auto ${innerClassName || ""}`}>{children}</div> | ||
export const Section = ({ children, backgroundColor, border, className, innerClassName }: SectionProps) => ( | ||
<SectionWrapper backgroundColor={backgroundColor} border={border} className={cn(className, { hasBorder: border })}> | ||
<div className={cn("container px-10 mx-auto", innerClassName)}>{children}</div> | ||
</SectionWrapper> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
import { Page } from "./components/Page"; | ||
import { Section } from "./components/Section"; | ||
|
||
export { Page, Section }; | ||
export * from "./components/Page"; | ||
export * from "./components/Section"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.