Skip to content

Commit

Permalink
Merge pull request #56 from Gum-Joe/MS1.5-CSS-Refactor-To-SCSS
Browse files Browse the repository at this point in the history
Refactor CSS to SCSS and fix some issues.
Please now use the SCSS instead of the CSS - changes to the CSS will not be reflected in the site.
  • Loading branch information
Gum-Joe authored Jun 23, 2021
2 parents 349c13c + ccab5a7 commit 505554f
Show file tree
Hide file tree
Showing 25 changed files with 2,270 additions and 289 deletions.
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "1.0.0-beta.5",
"version": "1.1.0-beta.2",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.34",
Expand All @@ -24,6 +24,7 @@
"focus-trap-react": "^8.4.1",
"ical": "^0.8.0",
"js-cookie": "^2.2.1",
"node-sass": "^4.0.0",
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-cookie-consent": "^6.2.1",
Expand Down
54 changes: 33 additions & 21 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
@import url("./fonts/Metropolis/stylesheet.css");
@import "youtube.css";

/**
NOTE: HACK: FIXME: STOP!!!!!!
WE NOW USE SCSS FOR STYLES
*/

@keyframes slide-in-top {
from {
transform: translateY(-10vh);
Expand Down Expand Up @@ -141,7 +146,7 @@ button.filled-button {
padding-top: 0px;
padding-right: 1em;
padding-left: 1em;
background-color: var(--rykan-accent-primary);
background-color: var(--site-primary);
color: #FFF;
}

Expand Down Expand Up @@ -193,7 +198,7 @@ button.back::before {
button.forward::before {
content: "";
/* background-image: linear-gradient(to right, var(--rykan-accent-primary), var(--rykan-accent-secondary)); */
background-color: var(--rykan-accent-primary);
background-color: var(--site-primary);
position: absolute;
height: calc(100% + 8px);
width: calc(100% + 8px);
Expand Down Expand Up @@ -225,7 +230,7 @@ button.forward.b:hover::before {
button.back::after {
content: "";
/* background-image: linear-gradient(to right, var(--rykan-accent-primary), var(--rykan-accent-secondary)); */
background-color: var(--rykan-accent-primary);
background-color: var(--site-primary);
position: absolute;
height: 3px;
width: 100%;
Expand Down Expand Up @@ -406,13 +411,20 @@ button.back::after {
/* background-color: #B80000 */
}

/** Ensure spacing above phablet */
@media screen and (min-width: 500px) {
/** Ensure nice bottom spacing */
.events-row a {
margin-bottom: 25px;
}
}
/** Phablet */
@media screen and (max-width: 700px) {

@media screen and (max-width: 600px) {
.events-row {
flex-direction: column;
height: 85vh;
}

.r-banner-container {
top: min(20vh, 144px);
/*bottom: 28px;*/
Expand All @@ -429,13 +441,15 @@ button.back::after {
}
}

@media screen and (min-width: 500px) {
.events-row a {
margin-bottom: 25px;
/** At phablet sizes, use justify content to vertically centre events rows. Below this, it no longer looks right (too much spacing!) */
@media screen and (max-width: 700px) and (min-width: 500px) {
.events-row {
justify-content: center;
}
}

@media screen and (max-width: 400px) {
/* Mobile */
@media screen and (max-width: 500px) {
.isitweeka h1 {
/*font-size: 5em;*/
margin-top: 0;
Expand Down Expand Up @@ -561,9 +575,11 @@ button.back::after {
}
}

/* HERE */

:root {
--rykan-accent-primary: #F10DA2;
--rykan-accent-secondary: #FE5000;
--site-primary: #F10DA2;
--site-secondary: #FE5000;
background: black;
color: white;
--icon-fill: white;
Expand Down Expand Up @@ -613,7 +629,7 @@ a {
left: 0;
right: 0;
height: 4px;
background-color: var(--rykan-accent-primary);
background-color: var(--site-primary);
}

.r-tab {
Expand Down Expand Up @@ -735,7 +751,7 @@ a {
width: 100%;
height: 4px;
bottom: 0;
background-color: var(--rykan-accent-primary);
background-color: var(--site-primary);
transition-duration: 200ms;
}

Expand Down Expand Up @@ -884,7 +900,7 @@ a {
color:rgba(0, 0, 0, 1);
}


/* ABOVE (Mailing list) has been copied but not sorted */

/** Cookie Consent **/

Expand All @@ -905,11 +921,7 @@ a {
color: #FFF !important;
}

@media screen and (max-aspect-ratio: 1/2) {
.not-x {
display: none!important;
}
}

/* Socials */
.social-container {
display: flex;
Expand Down Expand Up @@ -986,7 +998,7 @@ a {
}

.footer a:hover {
color: var(--french-blue-brighter);
color: var(--french-blue-brighter) ;
}

.footer #feedback-buttom {
Expand Down Expand Up @@ -1026,7 +1038,7 @@ a {
}

/* Responsive design */
@media screen and (max-width: 600px) {
@media screen and (max-width: 700px) {
.footer {
padding-left: 5vw;
padding-right: 5vw;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from "react";
import gaSetState from "./utils/gAnalytics";
import "./App.css";
//import "./App.css";
import "./scss/index.scss";
import CookieConsent from "react-cookie-consent";
import SiteContainer from "./components/SiteContainer";
import { TabContainer } from "./components/Tabs";
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/SiteContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ export default class SiteContainer extends Component<SiteProps, TheState> {
}
</div>
<Banner />
<YearGroupCalendar />
{ /* Pulled offline due to jankiness. Readd once a better solution with proper mobile styles and dedicated place is found:
<YearGroupCalendar /> */ }
<EventsList eventData={this.state.eventData} />
</>
);
Expand Down
1 change: 1 addition & 0 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
//import "./scss/index.scss";
import App from "./App";
import reportWebVitals from "./reportWebVitals";

Expand Down
37 changes: 37 additions & 0 deletions frontend/src/scss/_animations.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/** Animations we use. Each has a mixin */

@keyframes slide-in-top {
from {
transform: translateY(-10vh);
opacity: 0;
}

to {
transform: translateY(0);
opacity: 1;
}
}

// @param animation-delay: wait this many miliseconds before starting the animation
@mixin slide-in-top($animation-length: 300ms, $animation-delay: 100ms) {
animation: slide-in-top $animation-length both;
animation-delay: $animation-delay;
}

@keyframes slide-in-bottom {
from {
transform: translateY(10vh) scale(0.9375);
opacity: 0;
}

to {
transform: translateY(0) scale(1);
opacity: 1;
}
}

// @param animation-delay: wait this many miliseconds before starting the animation
@mixin slide-in-bottom($animation-length: 300ms, $animation-delay: 100ms) {
animation: slide-in-bottom $animation-length both;
animation-delay: $animation-delay;
}
85 changes: 85 additions & 0 deletions frontend/src/scss/_breakpoints.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/**
* This file defines the breakpoints which are used to modiy CSS at different screen sizes (widths)
* for responsive design purposes
*/
// From https://medium.com/codeartisan/breakpoints-and-media-queries-in-scss-46e8f551e2f2

/// /**
/// * BREAKPOINTS: (each level defines the number UNDER which styles should occur
/// * - Desktop: >1700px
/// * - Laptop: <= 1700px (laptops tend to have narrower screens, which can squish things)
/// * - Tablet: <= 1050px
/// * - Phablet: 700px
/// * - Mobile: 500px (to account for narrower phones)
/// */
$desktop: 1700px;
$laptop: 1700px;
$tablet: 1050px; /* NOTE: If 1050px is changes, make sure to change it in TSX! (const SHOW_MOBILE_AT_WIDTH in MailingListBanner.tsx */
$phablet: 700px;
$mobile: 500px;

/// Mixin for desktop only styles
@mixin desktop {
@media screen and (min-width: #{$desktop}) {
@content;
}
}

/// Mixin for laptop and below only styles
@mixin laptop {
@media screen and (max-width: #{$laptop}) {
@content;
}
}

/// Mixin for tablet and below only styles
@mixin tablet {
@media screen and (max-width: #{$tablet}) {
@content;
}
}

/// Mixin for phablet and below only styles
@mixin phablet {
@media screen and (max-width: #{$phablet}) {
@content;
}
}

/// Mixin for mobile and below only styles
@mixin mobile {
@media screen and (max-width: #{$mobile}) {
@content;
}
}

/// Mixin to have styles between two breakpoints. Provides it one of the breakpoint vars above.
/// @param {String} $minimum - Minimum screen size to activate at
/// @param {String} $maximum - Maximum screen size to activate at
@mixin between($minimum, $maximum) {
@media screen and (min-width: #{$minimum}) and (max-width: #{$maximum}) {
@content;
}
}

/// Mixin for arbitary breakpoints
/// @param {String} $type "min" or "max" (min-width or max-width)
@mixin breakpoint-at($min-max-width: string, $breakpoint-type: "min" or "max") {
@if $breakpoint-type != "min" and $breakpoint-type != "max" {
@error "Invalid type provided!";
}
@if $breakpoint-type == "min" {
@media screen and (min-width: #{$min-max-width}) {
@content;
}
}
@if $breakpoint-type == "max" {
@media screen and (max-width: #{$min-max-width}) {
@content;
}
}
}




15 changes: 15 additions & 0 deletions frontend/src/scss/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Useful mixins

// No top or bottom margin on a component
@mixin no-margin-top-bottom {
margin-top: 0;
margin-bottom: 0;
}


// Fully centred flex
@mixin flex-fully-centred {
display: flex;
align-items: center;
justify-content: center;
}
40 changes: 40 additions & 0 deletions frontend/src/scss/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Contains site-wide variable
*/


// Many of these were originally CSS vars, so have left these as is
:root {
background: black;
color: white;

--site-primary: #F10DA2;
--site-secondary: #FE5000;
--background-default: #000000;

// Text
--icon-fill: white;
--text-default: #fff;
--link-active: rgba(255, 255, 255, 0.6);

// We use this colours for a variety of purposes, namely the alert banners
--midland-red: #DC143C;
--south-eastern-yellow: #FECB09;
--great-western-green: #013602;
/* Slighty darkened, original was #00A550 */
--great-northern-green: rgb(0, 156, 76);
--north-western-blue: #080028;
--french-blue-brighter: #2B69D4;
--alt-blue: #0284db;
--an-orange: #F4511E;

--link-blue: #00B0FF; // Or at least, is used in jumbotron!

// Margin and spacing vars
--horizontal-indent: 10vw;
}

// For autocomplete - ALWASY REFER TO ABOVE!
$text-default: var(--text-default);
$site-primary: var(--site-primary);
$background-default: var(--background-default);
Loading

0 comments on commit 505554f

Please sign in to comment.