Skip to content

Commit

Permalink
Functional components/layout/* with css modules (#3278)
Browse files Browse the repository at this point in the history
  • Loading branch information
amass01 authored Mar 22, 2021
1 parent 249b17b commit 23e7b3a
Show file tree
Hide file tree
Showing 56 changed files with 787 additions and 921 deletions.
9 changes: 0 additions & 9 deletions app/components/layout/BlurableContainer.js

This file was deleted.

14 changes: 14 additions & 0 deletions app/components/layout/BlurableContainer/BlurableContainer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { classNames } from "pi-ui";
import { useModalVisible } from "./hooks";
import styles from "./BlurableContainer.module.css";

const BlurableContainer = ({ className, children }) => {
const { modalVisible } = useModalVisible();
return (
<div className={classNames(className, modalVisible && styles.blur)}>
{children}
</div>
);
};

export default BlurableContainer;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.blur {
filter: blur(5px);
}
10 changes: 10 additions & 0 deletions app/components/layout/BlurableContainer/hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { useSelector } from "react-redux";
import * as sel from "selectors";

export const useModalVisible = () => {
const modalVisible = useSelector(sel.modalVisible);

return {
modalVisible
};
};
1 change: 1 addition & 0 deletions app/components/layout/BlurableContainer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./BlurableContainer";
8 changes: 0 additions & 8 deletions app/components/layout/DescriptionHeader.js

This file was deleted.

11 changes: 11 additions & 0 deletions app/components/layout/DescriptionHeader/DescriptionHeader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { classNames } from "pi-ui";
import styles from "./DescriptionHeader.module.css";

const DescriptionHeader = ({ description, actionButton, className }) => (
<div className={classNames(styles.header, className)}>
<div className={styles.actionButton}>{actionButton}</div>
{description}
</div>
);

export default DescriptionHeader;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.header {
white-space: pre-wrap;
color: var(--header-desc-lighter-color);
font-size: 13px;
float: left;
width: 100%;
margin-left: 40px;
}

.actionButton {
position: absolute;
right: 80px;
}

.actionButton > .button {
min-width: 76px;
}
1 change: 1 addition & 0 deletions app/components/layout/DescriptionHeader/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./DescriptionHeader";
22 changes: 0 additions & 22 deletions app/components/layout/StandaloneHeader.js

This file was deleted.

21 changes: 21 additions & 0 deletions app/components/layout/StandaloneHeader/StandaloneHeader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { TitleHeader } from "../TitleHeader";
import DescriptionHeader from "../DescriptionHeader";
import styles from "./StandaloneHeader.module.css";

const StandaloneHeader = ({
title,
description,
iconType,
actionButton
}) => (
<div className={styles.header}>
<TitleHeader
title={title}
iconType={iconType}
optionalButton={actionButton}
/>
<DescriptionHeader description={description} />
</div>
);

export default StandaloneHeader;
27 changes: 27 additions & 0 deletions app/components/layout/StandaloneHeader/StandaloneHeader.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.header {
background-color: var(--background-back-color);
padding: 43px 60px 0px 63px;
position: absolute;
top: 0px;
right: 0px;
left: 0px;
height: 114px;
}

@media screen and (max-width: 1179px) {
.header {
padding-left: 20px;
}
}

@media screen and (max-width: 768px) {
.header {
height: initial;
display: flex;
flex-direction: column;
width: 100%;
position: relative;
padding-bottom: 48px;
padding-top: 30px;
}
}
1 change: 1 addition & 0 deletions app/components/layout/StandaloneHeader/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./StandaloneHeader";
17 changes: 0 additions & 17 deletions app/components/layout/StandalonePage.js

This file was deleted.

20 changes: 20 additions & 0 deletions app/components/layout/StandalonePage/StandalonePage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import StandalonePageBody from "../StandalonePageBody";
import { classNames } from "pi-ui";
import styles from "./StandalonePage.module.css";

const StandalonePage = ({ header, children, className }) => {
const body = header ? (
<StandalonePageBody>{children}</StandalonePageBody>
) : (
children
);

return (
<div className={classNames(styles.page, className)}>
{header}
{body}
</div>
);
};

export default StandalonePage;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.page {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
1 change: 1 addition & 0 deletions app/components/layout/StandalonePage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./StandalonePage";
3 changes: 0 additions & 3 deletions app/components/layout/StandalonePageBody.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styles from "./StandalonePageBody.module.css";

const StandalonePageBody = ({ children }) => (
<div className={styles.body}>{children}</div>
);

export default StandalonePageBody;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.body {
overflow-x: hidden;
overflow-y: scroll;
position: absolute;
right: 0px;
top: 157px;
bottom: 0px;
left: 0px;
padding: 38px 60px 30px 63px;
background-color: var(--background-container);
}

@media screen and (max-width: 1179px) {
.body {
padding-left: 20px;
}
}

@media screen and (max-width: 768px) {
.body {
top: 113px;
}
}
1 change: 1 addition & 0 deletions app/components/layout/StandalonePageBody/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "./StandalonePageBody";
Loading

0 comments on commit 23e7b3a

Please sign in to comment.