-
Notifications
You must be signed in to change notification settings - Fork 920
[UEPR-551] Display a read-only mode banner across scratch-www pages #10188
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
base: release/read-only-mode
Are you sure you want to change the base?
Changes from all commits
a8e4a3b
776d699
b4c7d45
9a74a9c
490498b
de92c27
bda9c76
8f003f5
f565aab
fd6afaa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| const classNames = require('classnames'); | ||
| const PropTypes = require('prop-types'); | ||
| const React = require('react'); | ||
| const FormattedMessage = require('react-intl').FormattedMessage; | ||
|
|
||
| require('./read-only-mode-banner.scss'); | ||
|
|
||
| const {READ_ONLY_MODE} = require('../../lib/feature-flags'); | ||
|
|
||
| const bold = chunks => <strong>{chunks}</strong>; | ||
|
|
||
| const ReadOnlyModeBanner = ({className}) => { | ||
| if (!READ_ONLY_MODE) return null; | ||
|
|
||
| return ( | ||
| <div className={classNames('read-only-mode-banner', className)}> | ||
| <div className="read-only-mode-banner-content"> | ||
| <p className="read-only-mode-banner-text"> | ||
| <FormattedMessage | ||
| id="readOnlyMode.title" | ||
| values={{b: bold}} | ||
| /> | ||
| </p> | ||
| <p className="read-only-mode-banner-text"> | ||
| <FormattedMessage id="readOnlyMode.description1" /> | ||
| </p> | ||
| <p className="read-only-mode-banner-text"> | ||
| <FormattedMessage | ||
| id="readOnlyMode.description2" | ||
| /> | ||
|
kbangelov marked this conversation as resolved.
|
||
| </p> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| ReadOnlyModeBanner.propTypes = { | ||
| className: PropTypes.string | ||
| }; | ||
|
|
||
| module.exports = ReadOnlyModeBanner; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| @use "../../colors"; | ||
| @use "../../frameless"; | ||
|
|
||
| .read-only-mode-banner { | ||
| display: flex; | ||
| width: 100%; | ||
| padding: 1.5rem 0; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| background-color: colors.$ui-sky-blue; | ||
| position: sticky; | ||
| top: 50px; /* matches fixed nav height */ | ||
| z-index: 9; /* below nav (z-index: 10) */ | ||
|
|
||
| .read-only-mode-banner-content { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 0.625rem; | ||
| } | ||
|
|
||
| .read-only-mode-banner-text { | ||
| color: colors.$ui-white; | ||
| font-size: 1rem; | ||
| font-weight: 400; | ||
| line-height: 1.5rem; | ||
| margin: 0; | ||
| } | ||
|
|
||
| .read-only-mode-banner-link { | ||
| color: colors.$ui-white; | ||
| text-decoration: underline; | ||
| } | ||
| } | ||
|
|
||
| @media only screen and (min-width: 942px) { | ||
| .read-only-mode-banner .read-only-mode-banner-content { | ||
| width: 58.875rem; | ||
| } | ||
| } | ||
|
|
||
| @media only screen and (min-width: 768px) and (max-width: 941px) { | ||
| .read-only-mode-banner .read-only-mode-banner-content { | ||
| width: 48rem; | ||
| } | ||
| } | ||
|
|
||
| @media only screen and (min-width: 480px) and (max-width: 767px) { | ||
| .read-only-mode-banner .read-only-mode-banner-content { | ||
| width: 30rem; | ||
| } | ||
| } | ||
|
|
||
| @media only screen and (max-width: 479px) { | ||
| .read-only-mode-banner .read-only-mode-banner-content { | ||
| max-width: calc(100% - 1rem); | ||
| } | ||
|
adzhindzhi marked this conversation as resolved.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,14 @@ | ||
| @use "../../frameless"; | ||
| @use "../../colors"; | ||
|
|
||
| .join { | ||
| position: absolute; | ||
| .join-page { | ||
| display: flex; | ||
| flex-direction: column; | ||
| background-color: colors.$ui-blue; | ||
| } | ||
|
|
||
| .join-header { | ||
| position: relative; | ||
| z-index: 1000; | ||
| top: 12px; | ||
| left: 12px; | ||
|
|
@@ -13,7 +20,24 @@ | |
| } | ||
|
|
||
| @media #{frameless.$small}, #{frameless.$medium}, #{frameless.$intermediate} { | ||
| .join { | ||
| .join-header { | ||
| left: calc(50% - 38px); | ||
| } | ||
| } | ||
|
|
||
| .mod-join-overlay { | ||
| position: relative; | ||
|
|
||
| // needed to apply overlay color all around the modal | ||
| &::before { | ||
| content: ""; | ||
| position: fixed; | ||
| inset: 0; | ||
| background-color: colors.$ui-blue; | ||
| } | ||
|
Comment on lines
+32
to
+37
Contributor
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. Why do we need that? Can we not add the
Contributor
Author
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. Since we changed the position from absolute to relative, it will only cover the height of the modal itself. We add min-height and the before handling in order to cover the spaces around it. (Since the .join-page class doesn't reach the modal due to the modal computing to a child of body - on the same level in the html structure, not a child). That's the solution I thought of, anyways. |
||
| } | ||
|
|
||
| .join-read-only-mode-banner { | ||
| margin-top: 1rem; // needed space from nav | ||
| z-index: 1001; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: I wonder if it'd make more sense to expose this as
allowVerticalOverflow/allowHorizontalOverflowprops, rather than passing a className, which may be too vague.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this single use, yes. If we were thinking long-term, then maybe other styles that we want to apply might come up.