From 1eeb421ddb04f196218f05b1d28dd1b912c09403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 13 Dec 2017 17:46:14 +0100 Subject: [PATCH] ux: updated login page --- .../core/components/Login/LoginBackground.tsx | 42 ++++++---- public/sass/pages/_login.scss | 78 +++++-------------- 2 files changed, 44 insertions(+), 76 deletions(-) diff --git a/public/app/core/components/Login/LoginBackground.tsx b/public/app/core/components/Login/LoginBackground.tsx index 1cb81b569b0..83e228ab6e0 100644 --- a/public/app/core/components/Login/LoginBackground.tsx +++ b/public/app/core/components/Login/LoginBackground.tsx @@ -1,29 +1,27 @@ import React, { Component } from 'react'; -const elementsInWidth = 22; -const elementRows = 50; +const xCount = 50; +const yCount = 50; -function Cell({ index, flipIndex }) { - const bgColor1 = getColor(index); - // const bgColor2 = getColor(index+2); +function Cell({ x, y, flipIndex }) { + const index = (y * xCount) + x; + const bgColor1 = getColor(x, y); return ( -
+
); } -const getRandomInt = (min, max) => { +function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive -}; +} export default class LoginBackground extends Component { - nrOfElements: number; cancelInterval: any; constructor(props) { super(props); - this.nrOfElements = elementsInWidth * elementRows; this.state = { flipIndex: null, @@ -33,14 +31,13 @@ export default class LoginBackground extends Component { } flipElements() { - const elementIndexToFlip = getRandomInt(0, this.nrOfElements - 1); + const elementIndexToFlip = getRandomInt(0, (xCount * yCount) - 1); this.setState(prevState => { return { ...prevState, flipIndex: elementIndexToFlip, }; }); - console.log('elementIndexToFlip', elementIndexToFlip); } componentWillMount() { @@ -56,9 +53,15 @@ export default class LoginBackground extends Component { return (
- {Array.from(Array(elementsInWidth * elementRows)).map((el, index) => { + {Array.from(Array(yCount)).map((el, y) => { return ( - +
+ {Array.from(Array(xCount)).map((el2, x) => { + return ( + + ); + })} +
); })}
@@ -66,7 +69,7 @@ export default class LoginBackground extends Component { } } -const getColor = index => { +function getColor(x, y) { const colors = [ '#14161A', '#111920', @@ -1228,5 +1231,10 @@ const getColor = index => { '#101A27', '#13171F', ]; - return colors[index]; -}; + + // let randX = getRandomInt(0, x); + // let randY = getRandomInt(0, y); + // let randIndex = randY * xCount + randX; + + return colors[(y*xCount + x) % colors.length]; +} diff --git a/public/sass/pages/_login.scss b/public/sass/pages/_login.scss index 66cf9bfe87d..ffc937e3872 100644 --- a/public/sass/pages/_login.scss +++ b/public/sass/pages/_login.scss @@ -73,6 +73,8 @@ select:-webkit-autofill:focus { display: flex; align-items: stretch; flex-direction: column; + position: relative; + z-index: 1; } .login-branding { @@ -293,7 +295,7 @@ select:-webkit-autofill:focus { padding: 2rem 4rem; .logo-icon { - width: 100px; + width: 130px; } .icon-gf-grafana_wordmark { @@ -333,13 +335,27 @@ select:-webkit-autofill:focus { left: 0; right: 0; perspective: 1000px; + display: flex; + flex-wrap: wrap; + z-index: 0; + flex-direction: column; + justify-content: stretch; + justify-items: stretch; + height: 100%; + + .login-bg__row { + display: flex; + flex-grow: 1; + height: 10px; + justify-content: stretch; + } .login-bg__item { width: 4%; - height: 10px; + height: 100%; + flex-grow: 1; // background: hotpink; // border:1px solid #0F1926; - float: left; transition: 1s ease-in-out; z-index: 1; transform-style: preserve-3d; @@ -348,7 +364,6 @@ select:-webkit-autofill:focus { transform: rotateY(180deg); } - &:before, &:after { backface-visibility: hidden; position: absolute; @@ -360,65 +375,10 @@ select:-webkit-autofill:focus { display: block; } - &:before { - z-index: 2; - transform: rotateY(0deg); - background-color: #215392; - } - &:after { transform: rotateY(180deg); background-color: rgb(25, 50, 80); } - - &:nth-child(3n+0) { - &:before { - background-color: #0f253c; - } - &:after { - background-color: blue; - } - } - - - &:nth-child(3n+1) { - &:before { - background-color: #102438; - } - &:after { - background-color: blue; - } - } - - &:nth-child(3n+2) { - &:before { - background-color: #19314e; - } - &:after { - background-color: blue; - } - } - - &:nth-child(3n+3) { - &:before { - background-color: #215392; - } - &:after { - background-color: blue; - } - } - - // &:nth-child(3n+5) { - // &:before { - // background-color: hotpink; - // } - // &:after { - // background-color: blue; - // } - // } - - - } }