mirror of
https://github.com/flarum/core.git
synced 2025-08-07 17:07:19 +02:00
Major CSS revamp
- Get rid of Bootstrap (except we still rely on some JS) - Use BEM class names - Rework variables/theme config - Fix various bugs, including some on mobile The CSS is still not ideal – it needs to be cleaned up some more. But that can be a focus for after beta.
This commit is contained in:
369
less/lib/App.less
Executable file
369
less/lib/App.less
Executable file
@@ -0,0 +1,369 @@
|
||||
.App {
|
||||
position: relative !important;
|
||||
padding-top: @header-height;
|
||||
|
||||
@media @phone {
|
||||
padding-top: @header-height-phone;
|
||||
}
|
||||
}
|
||||
|
||||
// Fix a solid white box to the top of the viewport. This toolbar's contents
|
||||
// will differ depending on the device: on phones it will be content
|
||||
// controls, whereas on desktops it will be the header. We will overlay
|
||||
// these things on top of it later.
|
||||
.App:before {
|
||||
content: " ";
|
||||
.header-background();
|
||||
border-bottom: 0;
|
||||
position: absolute;
|
||||
|
||||
.affix& {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.scrolled& {
|
||||
.box-shadow(0 2px 6px @shadow-color);
|
||||
}
|
||||
}
|
||||
|
||||
// PHONES: Somewhere on the page there will be a .back-button, a .primary-
|
||||
// control, and a .App-titleControl. We will position these on the left, right,
|
||||
// and center of the header respectively.
|
||||
@media @phone {
|
||||
.App-primaryControl, .App-titleControl, .App-backControl {
|
||||
position: absolute;
|
||||
z-index: @zindex-header + 1;
|
||||
top: 0;
|
||||
margin: 0;
|
||||
|
||||
.App.affix &, .Composer & {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
> .Button {
|
||||
float: none;
|
||||
background: transparent !important;
|
||||
.box-shadow(~"none !important");
|
||||
height: @header-height-phone;
|
||||
width: auto;
|
||||
padding: 13px !important;
|
||||
|
||||
&:active {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
.App-primaryControl {
|
||||
width: auto;
|
||||
right: 0;
|
||||
|
||||
&.Dropdown {
|
||||
.Button, .Button-caret {
|
||||
display: none !important;
|
||||
}
|
||||
.Dropdown-toggle, .Button-icon {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.App-primaryControl, .App-backControl {
|
||||
> .Button {
|
||||
color: @header-control-color !important;
|
||||
|
||||
.Button-icon {
|
||||
display: block;
|
||||
font-size: 20px;
|
||||
}
|
||||
.Button-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.App-titleControl {
|
||||
width: 200px;
|
||||
left: 50%;
|
||||
margin-left: -100px;
|
||||
text-align: center;
|
||||
color: @header-color !important;
|
||||
|
||||
&, > .Button {
|
||||
font-size: 16px;
|
||||
}
|
||||
> .Button {
|
||||
color: @header-color;
|
||||
}
|
||||
}
|
||||
.App-titleControl--text {
|
||||
line-height: 46px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: normal;
|
||||
}
|
||||
.App-backControl {
|
||||
left: 0;
|
||||
|
||||
.Navigation-pin {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Drawer
|
||||
|
||||
// On phones, the drawer is displayed in its semantic sense: as a drawer on
|
||||
// the left side of the screen. On other devices, the drawer has no specific
|
||||
// appearance.
|
||||
@media @phone {
|
||||
.drawerOpen {
|
||||
overflow: hidden;
|
||||
}
|
||||
.App-drawer {
|
||||
background: @header-bg;
|
||||
width: @drawer-width;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
.box-shadow(0 2px 6px @shadow-color);
|
||||
.translate3d(-@drawer-width - 6px, 0, 0);
|
||||
.transition-transform(0.2s);
|
||||
z-index: @zindex-modal;
|
||||
|
||||
// & when (@config-colored-header = true) {
|
||||
// .light-contents();
|
||||
// }
|
||||
|
||||
.drawerOpen & {
|
||||
-webkit-transform: none !important;
|
||||
transform: none !important;
|
||||
}
|
||||
}
|
||||
.drawer-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: @zindex-modal-background;
|
||||
background-color: @overlay-bg;
|
||||
opacity: 0;
|
||||
.transition(0.2s opacity);
|
||||
|
||||
&.in {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Header
|
||||
|
||||
.Header-controls {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
// On phones, the header is displayed inside of the drawer. We lay its
|
||||
// contents out vertically.
|
||||
@media @phone {
|
||||
.App-header {
|
||||
.container {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
.Header-navigation {
|
||||
display: none;
|
||||
}
|
||||
.Header-title {
|
||||
border-bottom: 1px solid @header-control-bg;
|
||||
font-size: 16px;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
line-height: @header-height-phone - 1;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
.Header-controls {
|
||||
> li {
|
||||
padding: 10px 10px 0;
|
||||
}
|
||||
.FormControl, .ButtonGroup, .Button {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
.Dropdown-menu {
|
||||
.ButtonGroup, .Button {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On other devices, we stick the header up the top of the page, overlaying
|
||||
// the page toolbar that we styled earlier. We lay its contents out
|
||||
// horizontally.
|
||||
@media @phone {
|
||||
.App-drawer {
|
||||
& when (@config-colored-header = true) {
|
||||
.light-contents(@header-color, @header-control-bg, @header-control-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media @tablet-up {
|
||||
.App-navigation {
|
||||
display: none;
|
||||
}
|
||||
.App-header {
|
||||
padding: 10px;
|
||||
height: @header-height;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: @zindex-header;
|
||||
.clearfix();
|
||||
|
||||
.affix & {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
& when (@config-colored-header = true) {
|
||||
.light-contents(@header-color, @header-control-bg, @header-control-color);
|
||||
}
|
||||
}
|
||||
|
||||
.Header-navigation {
|
||||
float: left;
|
||||
margin-right: 25px;
|
||||
}
|
||||
.Header-controls {
|
||||
&, > li {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.Header-primary {
|
||||
float: left;
|
||||
}
|
||||
.Header-title {
|
||||
float: left;
|
||||
vertical-align: top;
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
line-height: 36px;
|
||||
}
|
||||
.Header-secondary {
|
||||
float: right;
|
||||
|
||||
.Search {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Content Area
|
||||
|
||||
.App-content {
|
||||
border-top: 1px solid @control-bg;
|
||||
}
|
||||
|
||||
// On phones, the content area overlays the drawer, so we must give it a
|
||||
// background and min-height so it cannot be seen through. When the drawer is
|
||||
// meant to be open, we slide the content to the right to reveal the drawer.
|
||||
@media @phone {
|
||||
.App-content {
|
||||
background: @body-bg;
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------
|
||||
// Footer
|
||||
|
||||
.Footer-controls {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
|
||||
> li {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
// On phones, the footer is displayed at the bottom of the drawer. The
|
||||
// footer's primary controls don't display, but the secondary ones do.
|
||||
// @todo Maybe we should reverse the naming of primary/secondary then?
|
||||
@media @phone {
|
||||
.App-footer {
|
||||
position: fixed;
|
||||
left: 15px;
|
||||
bottom: 15px;
|
||||
width: @drawer-width;
|
||||
margin: 0;
|
||||
z-index: 1;
|
||||
|
||||
.container {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
.Footer-primary {
|
||||
display: none;
|
||||
}
|
||||
.Footer-secondary {
|
||||
float: none;
|
||||
|
||||
> li {
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On other devices, we put the footer at the bottom of the page by absolutely
|
||||
// positioning it, relative to the page which we pad out at the bottom. We
|
||||
// show the primary controls on the left, and the secondary controls on the
|
||||
// right.
|
||||
@media @tablet-up {
|
||||
.App {
|
||||
padding-bottom: 100px;
|
||||
position: relative;
|
||||
}
|
||||
.App-footer {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
||||
&, a {
|
||||
color: @muted-more-color;
|
||||
}
|
||||
a {
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: @link-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
.Footer-primary {
|
||||
display: inline-block;
|
||||
|
||||
> li {
|
||||
margin-right: 15px;
|
||||
}
|
||||
}
|
||||
.Footer-secondary {
|
||||
float: right;
|
||||
|
||||
> li {
|
||||
margin-left: 15px;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user