Skip to content

Commit

Permalink
add per-environment styling (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
panentheos authored Dec 5, 2024
1 parent d41dbd5 commit 9a9345d
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 24 deletions.
6 changes: 0 additions & 6 deletions assets/css/dashboard/new-pa-message/associate-alert-page.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
.sidebar-container:has(
+ .page-content > .new-pa-message > .associate-alert-page
) {
display: none !important;
}

.associate-alert-page {
padding: 24px 48px;
}
Expand Down
1 change: 0 additions & 1 deletion assets/css/screenplay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ $form-feedback-invalid-color: $text-error;
@import "place-row.scss";
@import "places-action-bar.scss";
@import "filter-dropdown.scss";
@import "sidebar.scss";
@import "screenplay-container.scss";
@import "screen-detail.scss";
@import "screen-simulation.scss";
Expand Down
45 changes: 33 additions & 12 deletions assets/css/sidebar.scss → assets/css/sidebar.module.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
.sidebar-container {
@import "./variables.scss";

.container {
width: $sidebar-width;
flex: none;
height: 100vh;
display: flex;
flex-direction: column;
gap: 48px;
padding-top: 32px;
gap: 32px;
overflow-y: auto;
background-color: #1e2933;
border-right: 1px solid #384e5c;
&:has(:global(+ .page-content > .new-pa-message > .associate-alert-page)) {
display: none !important;
}
}

.sidebar-link {
.link {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 0 10px;
padding: 8px 10px;
gap: 4px;
text-decoration: none;
color: #c1e4ff;
Expand All @@ -27,23 +31,40 @@
}
}

.sidebar-link-highlight {
.linkHighlight {
padding: 8px;
border-radius: 8px;
.sidebar-link.active &,
.sidebar-link:hover & {
.link.active &,
.link:hover & {
background-color: #384e5c;
}
}

.sidebar-logo {
.logo {
padding-top: 32px;
padding-bottom: 32px;
color: white;
text-decoration: none;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
&:global(.dev) {
color: black;
background-color: #d0d336;
}
&:global(.dev-green) {
color: black;
background-color: #7fee91;
}
}

.environmentName {
height: 0;
font-size: 10px;
}

.sidebar-link,
.sidebar-logo {
.link,
.logo {
&:focus-visible {
outline: 1px solid #c1e4ff;
outline-offset: -1px;
Expand Down
26 changes: 21 additions & 5 deletions assets/js/components/Dashboard/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import {
Icon,
} from "react-bootstrap-icons";
import TLogo from "../../../static/images/t-logo.svg";
import TLogoBlack from "../../../static/images/t-logo-black.svg";
import cx from "classnames";
import * as sidebarStyles from "Styles/sidebar.module.scss";

const SidebarLink = ({
to,
Expand All @@ -31,14 +34,16 @@ const SidebarLink = ({
return (
<NavLink
to={to}
className={({ isActive }) => `sidebar-link ${isActive ? "active" : ""}`}
className={({ isActive }) =>
cx(sidebarStyles.link, { [sidebarStyles.active]: isActive })
}
reloadDocument={reloadDocument}
>
{({ isActive }) => {
const IconComponent = isActive ? activeIcon : icon;
return (
<>
<span className="sidebar-link-highlight">
<span className={sidebarStyles.linkHighlight}>
<IconComponent size={36} />
</span>
<span>{children}</span>
Expand All @@ -56,11 +61,22 @@ const Sidebar = () => {
const isPaMessageAdmin = !!document.querySelector(
"meta[name=is-pa-message-admin]",
);
const environment =
document
.querySelector("meta[name=environment-name]")
?.getAttribute("content") ?? "prod";

return (
<nav className="sidebar-container">
<a href="/dashboard" className="sidebar-logo">
<img src={TLogo} alt="Screenplay Logo" style={{ width: 32 }} />
<nav className={sidebarStyles.container}>
<a href="/dashboard" className={cx(sidebarStyles.logo, environment)}>
<img
src={environment === "prod" ? TLogo : TLogoBlack}
alt="Screenplay Logo"
style={{ width: 32 }}
/>
<span className={sidebarStyles.environmentName}>
{{ dev: "Dev", "dev-green": "Dev-Green" }[environment]}
</span>
</a>
<SidebarLink to="/dashboard" icon={GeoAlt} activeIcon={GeoAltFill}>
Places
Expand Down
Binary file modified assets/static/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions assets/static/images/favicon-dev-green.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/static/images/favicon-dev.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/static/images/favicon-prod.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/static/images/t-logo-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions lib/screenplay_web/templates/layout/app.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
<% end %>
<%= csrf_meta_tag() %>
<title>Screenplay</title>
<link rel="icon" href={Routes.static_path(@conn, "/favicon.ico")} sizes="32x32">
<link rel="icon" href={Routes.static_path(@conn, "/images/favicon-#{@environment_name || "prod"}.svg")} type="image/svg+xml">
<link rel="stylesheet" href={Routes.static_path(@conn, "/css/app.css")}/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Expand Down

0 comments on commit 9a9345d

Please sign in to comment.