💄 Put new brand in header and fix toasts

This commit is contained in:
nikolark committed 2022-03-06 14:27:52 +01:00
1 parent 7bfa587a77
commit 13cc0d92a2
7 files changed
+86 -49

No files matched your search

+44 -15
View File
@@ -1,25 +1,12 @@
.nav { .nav {
display: flex; display: flex;
height: 3rem; height: 5rem;
align-items: center; align-items: center;
text-transform: uppercase; text-transform: uppercase;
} }
.logo {
position: relative;
top: 5px;
display: inline-block;
width: 24px;
height: 24px;
margin-right: 0.5rem;
margin-left: 1rem;
}
.logoNav { .logoNav {
position: relative; margin-left: 1.5rem;
top: -4px;
}
.logoNav:hover.logoNav:hover {
border-color: transparent;
} }
.navItems { .navItems {
@@ -40,3 +27,45 @@
.active.active { .active.active {
color: white; color: white;
} }
/* FIXME: Duplicates Splash styles */
.brand {
padding-left: 1rem;
color: var(--brand);
font-family: Rocket Rinder, monospace;
font-size: 3rem;
font-style: italic;
letter-spacing: 2px;
line-height: 1;
text-shadow: 0 0 4px rgba(243, 33, 61, 0.8), 0 0 11px rgba(243, 33, 61, 0.8), 0 0 19px rgba(243, 33, 61, 0.8);
}
.subtitle {
position: relative;
left: -8px;
animation: flicker 1.5s infinite alternate;
color: var(--interlace);
font-family: Rocket Clouds DEMO, serif;
font-size: 10px;
font-weight: bold;
line-height: 1;
transform: rotate(-6deg);
}
@keyframes flicker {
0%,
18%,
22%,
25%,
53%,
57%,
100% {
text-shadow: 0 0 4px rgba(121, 152, 238, 0.8), 0 0 11px rgba(121, 152, 238, 0.8), 0 0 19px rgba(121, 152, 238, 0.8);
}
20%,
24%,
55% {
text-shadow: none;
}
}
+3 -5
View File
@@ -13,11 +13,9 @@ export const Header: React.FC = () => {
return ( return (
<header> <header>
<nav className={styles.nav}> <nav className={styles.nav}>
<NavLink to="/" className={clsx([styles.navLink, styles.logoNav])}> <NavLink to="/" className={styles.logoNav}>
<span className={styles.logo}> <div className={styles.brand}>BBS</div>
<Logo /> <div className={styles.subtitle}>Biceps Bar System</div>
</span>
Biceps Bar System - BBS
</NavLink> </NavLink>
<ul className={styles.navItems}> <ul className={styles.navItems}>
<li> <li>
+1 -2
View File
@@ -4,8 +4,6 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
display: grid; display: grid;
font-family: Rocket Rinder, monospace;
/* color: var(--interlace-color); */
place-items: center; place-items: center;
text-align: center; text-align: center;
} }
@@ -30,6 +28,7 @@
left: -0.6rem; left: -0.6rem;
padding-top: 3rem; padding-top: 3rem;
color: var(--brand); color: var(--brand);
font-family: Rocket Rinder, monospace;
font-size: clamp(20px, 20vw, 200px); font-size: clamp(20px, 20vw, 200px);
font-style: italic; font-style: italic;
letter-spacing: 1rem; letter-spacing: 1rem;
+23
View File
@@ -2,4 +2,27 @@
position: absolute; position: absolute;
bottom: 32px; bottom: 32px;
left: 32px; left: 32px;
padding: 0.6rem 1.2rem;
border-radius: 4px;
opacity: 0;
pointer-events: none;
transition: opacity 0.1s ease-in-out;
}
.visible {
opacity: 1;
pointer-events: initial;
}
.primary {
background: linear-gradient(var(--sun) 30%, var(--sun-end) 100%);
box-shadow: 0 0 4px var(--sun), 0 0 11px var(--sun), 0 0 19px var(--sun);
}
.danger {
background: var(--brand);
box-shadow: 0 0 4px rgba(243, 33, 61, 0.8), 0 0 11px rgba(243, 33, 61, 0.8), 0 0 19px rgba(243, 33, 61, 0.8);
}
.close {
display: none;
} }
+5 -20
View File
@@ -1,33 +1,18 @@
import clsx from "clsx"; import clsx from "clsx";
import React, { useEffect, useRef } from "react"; import React from "react";
import styles from "./Toast.module.css"; import styles from "./Toast.module.css";
import { useToast } from "./ToastProvider"; import { useToast } from "./ToastProvider";
export const Toast: React.FC = () => { export const Toast: React.FC = () => {
const ref = useRef<HTMLInputElement>(null); const { showToast, message, background, visible } = useToast();
const { visible, showToast, message, background } = useToast();
const classes = clsx(`bg-${background}`, styles.toast); const classes = clsx([styles[background], styles.toast], { [styles.visible]: visible });
useEffect(() => {
if (!ref.current) return;
if (visible) {
// TODO
console.log("TODO: show");
} else if (!visible) {
// TODO
console.log("TODO: hide");
}
// TODO
return () => console.log("TODO: hide");
}, [visible]);
return ( return (
<div ref={ref} className={classes} role="alert" aria-live="assertive" aria-atomic="true"> <div className={classes} role="alert" aria-live="assertive" aria-atomic="true">
<div>{message}</div> <div>{message}</div>
<button type="button" aria-label="Close" onClick={() => showToast(message)} /> <button type="button" aria-label="Close" onClick={() => showToast(message)} className={styles.close} />
</div> </div>
); );
}; };
+9 -7
View File
@@ -1,21 +1,24 @@
import React, { ReactNode, useContext, useState } from "react"; import React, { ReactNode, useContext, useState } from "react";
type Background = "primary" | "danger";
interface ToastProps { interface ToastProps {
visible: boolean; visible: boolean;
message: string; message: string;
showToast: (message: string, background?: string) => void; showToast: (message: string, background?: Background) => void;
hide: () => void; hide: () => void;
background: string; background: Background;
} }
const defaultState = { const defaultState = {
// FIXME: revert
visible: false, visible: false,
message: "", message: "",
// eslint-disable-next-line @typescript-eslint/no-empty-function // eslint-disable-next-line @typescript-eslint/no-empty-function
showToast: () => {}, showToast: () => {},
// eslint-disable-next-line @typescript-eslint/no-empty-function // eslint-disable-next-line @typescript-eslint/no-empty-function
hide: () => {}, hide: () => {},
background: "primary", background: "primary" as Background,
}; };
const ToastContext = React.createContext<ToastProps>(defaultState); const ToastContext = React.createContext<ToastProps>(defaultState);
@@ -25,17 +28,16 @@ type ToastProviderProps = {
}; };
export const ToastProvider: React.FC<ToastProviderProps> = ({ children }) => { export const ToastProvider: React.FC<ToastProviderProps> = ({ children }) => {
const [visible, setVisible] = useState(defaultState.visible); const [visible, setVisible] = useState(defaultState.visible);
const [message, setMessage] = useState(""); const [message, setMessage] = useState(defaultState.message);
const [background, setBackground] = useState(""); const [background, setBackground] = useState(defaultState.background);
const showToast = (newMessage: string, background = "primary") => { const showToast = (newMessage: string, background: Background = "primary") => {
setMessage(newMessage); setMessage(newMessage);
setBackground(background); setBackground(background);
if (!visible) { if (!visible) {
setVisible(true); setVisible(true);
setTimeout(() => { setTimeout(() => {
setVisible(false); setVisible(false);
setMessage("");
}, 3000); }, 3000);
} }
}; };
@@ -1,6 +1,7 @@
.userList { .userList {
display: grid; display: grid;
height: 400px; height: 400px;
padding-top: 2rem;
grid-template-columns: repeat(12, 100px); grid-template-columns: repeat(12, 100px);
overflow-y: auto; overflow-y: auto;
row-gap: 16px; row-gap: 16px;