Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Room UI Redesign: Reduce Custom CSS #3337

Merged
merged 1 commit into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 31 additions & 26 deletions src/react-components/auth/SignInModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from "prop-types";
import { CloseButton } from "../input/CloseButton";
import { Modal } from "../modal/Modal";
import { FormattedMessage } from "react-intl";
import styles from "./SignInModal.scss";
import { Button } from "../input/Button";
import { TextInputField } from "../input/TextInputField";
import { Column } from "../layout/Column";
Expand Down Expand Up @@ -33,7 +32,7 @@ export function SubmitEmail({ onSubmitEmail, initialEmail, showPrivacy, privacyU
);

return (
<Column center padding as="form" onSubmit={onSubmitForm} className={styles.modalContent}>
<Column center padding as="form" onSubmit={onSubmitForm}>
<p>{message || <FormattedMessage id="sign-in.prompt" />}</p>
<TextInputField
name="email"
Expand All @@ -44,22 +43,24 @@ export function SubmitEmail({ onSubmitEmail, initialEmail, showPrivacy, privacyU
placeholder="[email protected]"
/>
{(showTerms || showPrivacy) && (
<b className={styles.terms}>
By proceeding, you agree to the{" "}
{showTerms && (
<>
<a rel="noopener noreferrer" target="_blank" href={termsUrl}>
terms of use
</a>{" "}
</>
)}
{showTerms && showPrivacy && "and "}
{showPrivacy && (
<a rel="noopener noreferrer" target="_blank" href={privacyUrl}>
privacy notice
</a>
)}.
</b>
<p>
<small>
By proceeding, you agree to the{" "}
{showTerms && (
<>
<a rel="noopener noreferrer" target="_blank" href={termsUrl}>
terms of use
</a>{" "}
</>
)}
{showTerms && showPrivacy && "and "}
{showPrivacy && (
<a rel="noopener noreferrer" target="_blank" href={privacyUrl}>
privacy notice
</a>
)}.
</small>
</p>
)}
<Button preset="accept" type="submit">
Next
Expand All @@ -84,16 +85,18 @@ SubmitEmail.propTypes = {

export function WaitForVerification({ email, onCancel, showNewsletterSignup }) {
return (
<Column center padding className={styles.modalContent}>
<Column center padding>
<p>
<FormattedMessage id="sign-in.auth-started" values={{ email }} />
</p>
{showNewsletterSignup && (
<p className={styles.newsletter}>
Want Hubs news sent to your inbox?<br />
<a href="https://eepurl.com/gX_fH9" target="_blank" rel="noopener noreferrer">
Subscribe for updates
</a>
<p>
<small>
Want Hubs news sent to your inbox?<br />
<a href="https://eepurl.com/gX_fH9" target="_blank" rel="noopener noreferrer">
Subscribe for updates
</a>
</small>
</p>
)}
<Button preset="cancel" onClick={onCancel}>
Expand All @@ -111,8 +114,10 @@ WaitForVerification.propTypes = {

export function SignInComplete({ message, continueText, onContinue }) {
return (
<Column center padding className={styles.modalContent}>
<b>{message}</b>
<Column center padding>
<p>
<b>{message}</b>
</p>
<p>{continueText}</p>
<Button preset="green" onClick={onContinue}>
Continue
Expand Down
16 changes: 0 additions & 16 deletions src/react-components/auth/SignInModal.scss

This file was deleted.

8 changes: 4 additions & 4 deletions src/react-components/auth/VerifyModal.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import PropTypes from "prop-types";
import styles from "./VerifyModal.scss";
import { Spinner } from "../misc/Spinner";
import { Modal } from "../modal/Modal";
import { Column } from "../layout/Column";
Expand All @@ -13,16 +12,17 @@ export const VerificationStep = {

export function EmailVerifying() {
return (
<Column center padding className={styles.modalContent}>
<Column center padding grow>
<b>Email Verifying</b>
<br />
<Spinner />
</Column>
);
}

export function EmailVerified({ origin }) {
return (
<Column center padding className={styles.modalContent}>
<Column center padding grow>
<b>Verification Complete</b>
<p>Please close this browser window and return to {origin}.</p>
</Column>
Expand All @@ -35,7 +35,7 @@ EmailVerified.propTypes = {

export function VerificationError({ error }) {
return (
<Column center padding className={styles.modalContent}>
<Column center padding grow>
<b>Error Verifying Email</b>
<p>{(error && error.message) || "Unknown Error"}</p>
</Column>
Expand Down
7 changes: 0 additions & 7 deletions src/react-components/auth/VerifyModal.scss

This file was deleted.

2 changes: 2 additions & 0 deletions src/react-components/input/InputField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
:local(.error) {
margin-top: 8px;
color: theme.$red;
align-self: flex-start;
}

:local(.info) {
margin-top: 8px;
color: theme.$grey;
align-self: flex-start;
}
34 changes: 20 additions & 14 deletions src/react-components/input/RadioInputField.stories.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
import React from "react";
import { RadioInputField } from "./RadioInputField";
import { RadioInputField, RadioInputOption } from "./RadioInputField";
import { Column } from "../layout/Column";

export default {
title: "RadioInputField"
};

export const All = args => (
export const All = () => (
<Column padding>
<RadioInputField {...args} />
<RadioInputField label="With Label" {...args} />
<RadioInputField label="Selected" {...args} value={2} />
<RadioInputField>
<RadioInputOption value={1} label="Option 1" description="Test description for option 1" />
<RadioInputOption value={2} label="Option 2" description="Test description for option 2" />
<RadioInputOption value={3} label="Option 3" description="Test description for option 3" />
<RadioInputOption value={4} label="Option 4 (No Description)" />
</RadioInputField>
<RadioInputField label="With Label">
<RadioInputOption value={1} label="Option 1" description="Test description for option 1" />
<RadioInputOption value={2} label="Option 2" description="Test description for option 2" />
<RadioInputOption value={3} label="Option 3" description="Test description for option 3" />
<RadioInputOption value={4} label="Option 4 (No Description)" />
</RadioInputField>
<RadioInputField label="Selected">
<RadioInputOption value={1} label="Option 1" description="Test description for option 1" />
<RadioInputOption checked value={2} label="Option 2" description="Test description for option 2" />
<RadioInputOption value={3} label="Option 3" description="Test description for option 3" />
<RadioInputOption value={4} label="Option 4 (No Description)" />
</RadioInputField>
</Column>
);

All.args = {
options: [
{ id: "1", label: "Option 1", description: "Test description for option 1", value: 1 },
{ id: "2", label: "Option 2", description: "Test description for option 2", value: 2 },
{ id: "3", label: "Option 3", description: "Test description for option 3", value: 3 },
{ id: "4", label: "Option 4 (No Description)", value: 4 }
]
};
26 changes: 23 additions & 3 deletions src/react-components/layout/Column.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@ import PropTypes from "prop-types";
import classNames from "classnames";
import styles from "./Column.scss";

export function Column({ as: Component, className, gap, padding, center, grow, overflow, children, ...rest }) {
export function Column({
as: Component,
className,
gap,
padding,
center,
centerMd,
grow,
overflow,
children,
...rest
}) {
const gapClass = gap === true ? styles.mdGap : styles[`${gap}Gap`];
const paddingClass = padding === true ? styles.lgPadding : styles[`${padding}Padding`];

Expand All @@ -14,7 +25,14 @@ export function Column({ as: Component, className, gap, padding, center, grow, o
styles.column,
gapClass,
paddingClass,
{ [styles.center]: center, [styles.grow]: grow, [styles.overflow]: overflow },
{
[styles.center]: center === true || center === "horizontal" || center === "both",
[styles.centerVertical]: center === "vertical" || center === "both",
[styles.centerMd]: centerMd === true || centerMd === "horizontal" || centerMd === "both",
[styles.centerVerticalMd]: centerMd === "vertical" || centerMd === "both",
[styles.grow]: grow,
[styles.overflow]: overflow
},
className
)}
>
Expand All @@ -29,7 +47,8 @@ Column.propTypes = {
children: PropTypes.node,
gap: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
padding: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
center: PropTypes.bool,
centerMd: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
center: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
grow: PropTypes.bool,
overflow: PropTypes.bool
};
Expand All @@ -38,6 +57,7 @@ Column.defaultProps = {
as: "div",
gap: "md",
center: false,
centerMd: false,
padding: false,
grow: false,
overflow: false
Expand Down
17 changes: 17 additions & 0 deletions src/react-components/layout/Column.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@
text-align: center;
}

:local(.center-vertical) {
justify-content: center;
}

:local(.center-md) {
@media(min-width: theme.$breakpoint-md) {
align-items: center;
text-align: center;
}
}

:local(.center-vertical-md) {
@media(min-width: theme.$breakpoint-md) {
justify-content: center;
}
}

:local(.grow) {
flex-grow: 1;
}
Expand Down
8 changes: 0 additions & 8 deletions src/react-components/layout/LoadingScreenLayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,4 @@
bottom: 10%;
width: 100%;
padding: 0 48px;

h3 {
font-weight: theme.$font-weight-bold;
}

p {
line-height: 1.25;
}
}
2 changes: 1 addition & 1 deletion src/react-components/modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function Modal({ title, beforeTitle, afterTitle, children, contentClassNa
{(title || beforeTitle || afterTitle) && (
<div className={styles.header}>
<div className={styles.beforeTitle}>{beforeTitle}</div>
<h1>{title}</h1>
<h5>{title}</h5>
<div className={styles.afterTitle}>{afterTitle}</div>
</div>
)}
Expand Down
5 changes: 0 additions & 5 deletions src/react-components/modal/Modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
border-bottom: 1px solid theme.$lightgrey;
align-items: center;
justify-content: center;

h1 {
font-size: theme.$font-size-sm;
font-weight: theme.$font-weight-bold;
}
}

:local(.before-title) {
Expand Down
3 changes: 1 addition & 2 deletions src/react-components/room/AutoExitWarningModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { FormattedMessage, defineMessages, useIntl } from "react-intl";
import PropTypes from "prop-types";
import { Modal } from "../modal/Modal";
import { Button } from "../input/Button";
import styles from "./AutoExitWarningModal.scss";
import { Column } from "../layout/Column";

export const AutoExitReason = {
Expand All @@ -27,7 +26,7 @@ export function AutoExitWarningModal({ onCancel, reason, secondsRemaining }) {

return (
<Modal title="Warning">
<Column padding center className={styles.autoExitWarningModal}>
<Column padding center>
<b>
<FormattedMessage id="autoexit.title" />
<span>{secondsRemaining}</span>
Expand Down
3 changes: 0 additions & 3 deletions src/react-components/room/AutoExitWarningModal.scss

This file was deleted.

Loading