Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions web/client/src/content/Login/Login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@
-webkit-text-fill-color: #f4f4f4 !important;
}

@media only screen and (min-width: $small) {
.login__background {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-size: cover;
z-index: -1;
}
}

@media only screen and (max-width: $small) {
.login__container {
padding: 0 40px;
Expand Down
30 changes: 27 additions & 3 deletions web/client/src/content/Login/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext, useCallback, useState } from 'react'
import React, { useContext, useCallback, useState, useEffect } from 'react'
import { motion, AnimatePresence } from 'framer-motion'
import { InlineNotification } from 'carbon-components-react'

Expand All @@ -9,11 +9,25 @@ import Header from '../../components/Header'

import AuthClient from '../../rest/auth'

const backgroundImages = [
'https://images.unsplash.com/photo-1486520299386-6d106b22014b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
'https://images.unsplash.com/photo-1582447702113-04667dcd1da9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
'https://images.unsplash.com/photo-1606669059257-19fc4ca49f79?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1268&q=80',
'https://images.unsplash.com/photo-1551454075-d9daea945c10?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
'https://images.unsplash.com/photo-1599775009931-5b0b46e8de2c?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
'https://images.unsplash.com/photo-1555950205-ff6f06049d8b?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1341&q=80',
'https://images.unsplash.com/photo-1530936491244-4265f39516e4?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1352&q=80',
'https://images.unsplash.com/photo-1501446529957-6226bd447c46?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1489&q=80',
'https://images.unsplash.com/photo-1559097622-2cff6decd452?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1267&q=80',
'https://images.unsplash.com/photo-1465920431246-94bf7d9d4269?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80',
]

const Login = ({ history }) => {
const { t, setCurrentUser } = useContext(AppContext)
const [error, setError] = useState('')
const [step, setStep] = useState(1)
const [loginId, setLoginId] = useState('')
const [wallpaperStyle, setWallpaperStyle] = useState({})

const initLogin = useCallback(
/**
Expand Down Expand Up @@ -49,11 +63,21 @@ const Login = ({ history }) => {
[loginId, setCurrentUser, t, history]
)

useEffect(() => {
const index = Math.round(Math.random() * 100) % backgroundImages.length
const url = backgroundImages[index]

setWallpaperStyle({
backgroundImage: `linear-gradient(90deg, rgba(22,22,22,1) 500px, rgba(0,0,0,0) 150%), url(${url})`,
})
}, [])

return (
<>
<Header removeLogin></Header>
<div className="login__background" style={wallpaperStyle} />
<Header removeLogin />
<div className="login__container">
<div className="login__spacer"></div>
<div className="login__spacer" />
<div>
<img src={logo} width="50px" className="marb-2" alt="OpenEEW" />
<h1 className="login__title">
Expand Down