Skip to content

Commit

Permalink
Merge pull request #157 from ChtiJS/fix/articleAndContent
Browse files Browse the repository at this point in the history
fix(css modules): switching to css modules on contentBlock and article
  • Loading branch information
nfroidure authored Dec 12, 2023
2 parents dc070e5 + 6ac55c5 commit 6419c19
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 31 deletions.
6 changes: 6 additions & 0 deletions src/components/article.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.root {
padding: var(--vRythm) 0;
}
.root:not(:last-child) {
border-bottom: var(--border) solid var(--dark);
}
11 changes: 2 additions & 9 deletions src/components/article.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import styles from './article.module.scss';
const Article = ({
children,
...props
}: {
children: React.ReactNode;
} & React.HTMLAttributes<HTMLElement>) => (
<article className="root" {...props}>
<article className={styles.root} {...props}>
{children}
<style jsx>{`
.root {
padding: var(--vRythm) 0;
}
.root:not(:last-child) {
border-bottom: var(--border) solid var(--dark);
}
`}</style>
</article>
);

Expand Down
18 changes: 18 additions & 0 deletions src/components/contentBlock.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@import "../layouts/variables.scss";

.root {
background-color: var(--light);
padding: calc(var(--vRythm) * 2) var(--gutter);
}

@media screen and (min-width: $CSS_BREAKPOINT_START_L) {
.root {
padding: calc(var(--vRythm) * 2) calc(var(--gutter) * 2);
}
}

@media screen and (min-width: $CSS_BREAKPOINT_START_XL) {
.root {
padding: calc(var(--vRythm) * 3) calc(var(--gutter) * 8);
}
}
23 changes: 2 additions & 21 deletions src/components/contentBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
CSS_BREAKPOINT_START_L,
CSS_BREAKPOINT_START_XL,
} from '../utils/constants';
import styles from './contentBlock.module.scss';

export default function ContentBlock({
children,
Expand All @@ -11,24 +8,8 @@ export default function ContentBlock({
className?: string;
}): JSX.Element {
return (
<section className={`root${className ? ' ' + className : ''}`}>
<section className={`${styles.root} root${className ? ' ' + className : ''}`}>
{children}
<style jsx>{`
.root {
background-color: var(--light);
padding: calc(var(--vRythm) * 2) var(--gutter);
}
@media screen and (min-width: ${CSS_BREAKPOINT_START_L}) {
.root {
padding: calc(var(--vRythm) * 2) calc(var(--gutter) * 2);
}
}
@media screen and (min-width: ${CSS_BREAKPOINT_START_XL}) {
.root {
padding: calc(var(--vRythm) * 3) calc(var(--gutter) * 8);
}
}
`}</style>
</section>
);
}
2 changes: 1 addition & 1 deletion src/layouts/main.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
display: grid;
grid-template-columns: var(--block) 1fr;
grid-template-rows:
calc(var(--vRythm) * 6) auto
calc(var(--vRythm) * 8) auto
auto minmax(calc(var(--vRythm) * 2), auto);
background: var(--tertiary);
}
Expand Down

0 comments on commit 6419c19

Please sign in to comment.