Commit a612bb93 authored by Robert Knight's avatar Robert Knight

Cleanup styles for top-level components in the app

Refactor the styles used by the `HypothesisApp` component and other
top-level elements in the sidebar page to follow the conventions used by
other components. Also clean up some unused styles.

- Rename CSS classes for `HypothesisApp` component to `hypothesis-app*`
  to follow our normal naming conventions

- Consolidate styles for the `body` element in `sidebar.scss`

- Consolidate general element styles in `elements.scss`, eliminating
  `common.scss`

- Remove unnecessary styles for `html` and `body`

- Move `sheet` styles into `focused-mode-header` class, since these
  styles were only ever applied to that element

- Extract the styles from the `content` class used to center content in
  the top bar and content area into a mixin and then use that mixin in
  the component styles for the top bar and content area

- Remove unused mixin imports from `sidebar.scss`. These are no longer
  needed since the transition to the new SASS module system
parent 8f874371
...@@ -49,7 +49,7 @@ export default function FocusedModeHeader() { ...@@ -49,7 +49,7 @@ export default function FocusedModeHeader() {
})(); })();
return ( return (
<div className="focused-mode-header sheet sheet--short"> <div className="focused-mode-header">
{filterStatus} {filterStatus}
<button onClick={toggleFocusedMode} className="focused-mode-header__btn"> <button onClick={toggleFocusedMode} className="focused-mode-header__btn">
{buttonText} {buttonText}
......
...@@ -151,7 +151,7 @@ function HypothesisApp({ ...@@ -151,7 +151,7 @@ function HypothesisApp({
return ( return (
<div <div
className="app-content-wrapper js-thread-list-scroll-root" className="hypothesis-app js-thread-list-scroll-root"
style={backgroundStyle} style={backgroundStyle}
> >
<TopBar <TopBar
...@@ -161,7 +161,7 @@ function HypothesisApp({ ...@@ -161,7 +161,7 @@ function HypothesisApp({
onLogout={logout} onLogout={logout}
isSidebar={isSidebar} isSidebar={isSidebar}
/> />
<div className="content"> <div className="hypothesis-app__content">
<ToastMessages /> <ToastMessages />
<HelpPanel auth={authState} /> <HelpPanel auth={authState} />
<ShareAnnotationsPanel /> <ShareAnnotationsPanel />
......
@use "./responsive";
@mixin sidebar-content {
margin-left: auto;
margin-right: auto;
@include responsive.respond-to(tablets desktops) {
margin: auto;
max-width: responsive.$break-tablet;
padding-left: 4rem;
padding-right: 4rem;
}
}
@use "../variables" as var;
//ELEMENT STYLES////////////////////////////////
body {
position: relative;
background-color: var.$body-background;
color: var.$text-color;
}
p {
hyphens: auto;
& + p {
margin: 1em 0 0;
}
}
em {
font-style: italic;
}
html {
font-size: var.$base-font-size;
line-height: var.$base-line-height;
}
//MCRANDOM////////////////////////////////
.small {
font-size: var.$body1-font-size;
}
//CLOSER////////////////////////////////
.close {
cursor: pointer;
float: right;
opacity: 0.6;
&:active,
&:hover {
opacity: 1;
}
}
//FORM RELATED////////////////////////////////
.form-vertical {
legend {
font-size: var.$body1-font-size;
line-height: var.$body1-line-height;
margin-top: 1.5em;
margin-bottom: 1.5em;
}
select,
textarea,
input,
button {
display: block;
// margin-top: .75em;
}
}
@use "../../mixins/focus"; @use "../../mixins/focus";
@use "../../mixins/forms"; @use "../../mixins/forms";
@use "../../variables" as var;
// A dark grey button used for the primary action // A dark grey button used for the primary action
// in a form // in a form
.focused-mode-header { .focused-mode-header {
display: flex; display: flex;
align-items: center; align-items: center;
position: relative;
background-color: var.$body-background;
border-radius: 2px;
border: solid 1px var.$grey-3;
font-family: var.$sans-font-family;
font-weight: 300;
margin-bottom: 0.72em;
padding: 0.5em 1em;
&__btn { &__btn {
@include forms.primary-action-btn; @include forms.primary-action-btn;
......
@use "../../variables" as var;
@use "../mixins/layout";
@use "../mixins/responsive";
.hypothesis-app {
$sidebar-h-padding: 9px;
background: var.$grey-2;
min-height: 100%;
height: 100%;
overflow: scroll;
-webkit-overflow-scrolling: touch;
padding: $sidebar-h-padding;
padding-top: $sidebar-h-padding + var.$top-bar-height;
@include responsive.respond-to(tablets desktops) {
padding-bottom: 4rem;
}
&__content {
@include layout.sidebar-content;
}
}
// Disable scroll anchoring as it interferes with `ThreadList` and
// `visible-threads` calculations and can cause a render loop
.js-thread-list-scroll-root {
overflow-anchor: none;
}
@use "../../mixins/buttons"; @use "../../mixins/buttons";
@use "../../mixins/layout";
@use "../../variables" as var; @use "../../variables" as var;
.top-bar { .top-bar {
...@@ -63,6 +64,8 @@ ...@@ -63,6 +64,8 @@
} }
.top-bar__inner { .top-bar__inner {
@include layout.sidebar-content;
// the edges of the top-bar's contents should be aligned // the edges of the top-bar's contents should be aligned
// with the edges of annotation cards displayed below // with the edges of annotation cards displayed below
$h-padding: 9px; $h-padding: 9px;
......
...@@ -16,6 +16,18 @@ a:hover { ...@@ -16,6 +16,18 @@ a:hover {
color: var.$link-color-hover; color: var.$link-color-hover;
} }
em {
font-style: italic;
}
p {
hyphens: auto;
& + p {
margin: 1em 0 0;
}
}
ol { ol {
list-style-type: decimal; list-style-type: decimal;
padding-left: 3em; padding-left: 3em;
......
// Variables and mixins
// --------------------
@use '../variables' as var with ( @use '../variables' as var with (
$base-font-size: 12px, $base-font-size: 12px,
$base-line-height: 20px $base-line-height: 20px
); );
@use '../mixins/buttons';
@use '../mixins/focus';
@use '../mixins/forms';
@use '../mixins/icons';
@use '../mixins/responsive';
// Base styles // Base styles
// ----------- // -----------
...@@ -16,12 +9,6 @@ ...@@ -16,12 +9,6 @@
@use '../util'; @use '../util';
@use './elements'; @use './elements';
// Misc. legacy :(
// ---------------
@use '../forms' as forms2;
@use './styled-text';
@use './common';
// Components // Components
// ---------- // ----------
@use './components/annotation-action-bar'; @use './components/annotation-action-bar';
...@@ -43,6 +30,7 @@ ...@@ -43,6 +30,7 @@
@use './components/group-list'; @use './components/group-list';
@use './components/group-list-item'; @use './components/group-list-item';
@use './components/help-panel'; @use './components/help-panel';
@use './components/hypothesis-app';
@use './components/logged-out-message'; @use './components/logged-out-message';
@use './components/markdown-editor'; @use './components/markdown-editor';
@use './components/markdown-view'; @use './components/markdown-view';
...@@ -73,106 +61,14 @@ ...@@ -73,106 +61,14 @@
// Top-level styles // Top-level styles
// ---------------- // ----------------
html,
body {
height: 100%;
}
body { body {
background: var.$grey-2;
font-family: var.$sans-font-family;
font-weight: normal;
-webkit-overflow-scrolling: touch;
}
hypothesis-app {
display: block;
height: 100%; height: 100%;
}
.app-content-wrapper {
$sidebar-h-padding: 9px;
background: var.$grey-2;
min-height: 100%;
height: 100%;
overflow: scroll;
-webkit-overflow-scrolling: touch;
padding: $sidebar-h-padding;
padding-top: $sidebar-h-padding + var.$top-bar-height;
@include responsive.respond-to(tablets desktops) {
padding-bottom: 4rem;
}
}
.content {
margin-left: auto;
margin-right: auto;
@include responsive.respond-to(tablets desktops) {
margin: auto;
max-width: responsive.$break-tablet;
padding-left: 4rem;
padding-right: 4rem;
}
}
// Disable scroll anchoring as it interferes with `ThreadList` and
// `visible-threads` calculations and can cause a render loop
.js-thread-list-scroll-root {
overflow-anchor: none;
}
// Elements in root template (viewer.html)
// ---------------------------------------
.sheet {
border: solid 1px var.$grey-3;
border-radius: 2px;
font-family: var.$sans-font-family;
font-weight: 300;
margin-bottom: 0.72em;
padding: 1em;
position: relative;
background-color: var.$body-background; background-color: var.$body-background;
color: var.$text-color;
.close { font-family: var.$sans-font-family;
position: absolute; font-size: var.$base-font-size;
right: 1em; font-weight: normal;
top: 1em; line-height: var.$base-line-height;
}
}
.sheet--short {
padding: 0.5em 1em;
}
.sheet--is-theme-clean {
padding-left: 30px;
padding-bottom: 30px;
margin-bottom: 20px;
margin-left: 5px;
margin-right: 5px;
}
.annotation-unavailable-message {
display: flex;
flex-direction: column;
border: 1px solid var.$grey-3;
padding-top: 30px;
padding-bottom: 30px;
border-radius: 3px;
align-items: center;
&__label {
text-align: center;
}
&__icon {
background-image: url(../images/icons/lock.svg);
background-repeat: no-repeat;
width: 56px;
height: 48px;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment