Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix maintenance banner width bug #8342

Merged
merged 3 commits into from
Dec 5, 2024
Merged
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
6 changes: 5 additions & 1 deletion frontend/src/app/commonComponents/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ interface Props {
children?: React.ReactNode;
slim?: boolean;
className?: string;
bodyClassName?: string;
}
const Alert = ({
type,
Expand All @@ -43,6 +44,7 @@ const Alert = ({
children,
slim,
className,
bodyClassName,
}: Props) => {
const classes = classnames(
"usa-alert",
Expand All @@ -51,6 +53,8 @@ const Alert = ({
className
);

const bodyClasses = classnames("usa-alert__body", bodyClassName);

// Decides element's role base on passed props
const getIdentifiedRole = () => {
if (role) {
Expand All @@ -73,7 +77,7 @@ const Alert = ({
role={getIdentifiedRole()}
aria-label={title ? `Alert: ${title}` : undefined}
>
<div className="usa-alert__body">
<div className={bodyClasses}>
{title && <div className="usa-alert__heading text-bold">{title}</div>}
<div id={bodyId} className="usa-alert__text">
{body || children}
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/app/commonComponents/MaintenanceBanner.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@use "../../scss/settings";

.maintenance-alert-background {
background-color: #9c3d10;
}

.maintenance-alert-body {
max-width: settings.$site-max-width !important;
}
10 changes: 8 additions & 2 deletions frontend/src/app/commonComponents/MaintenanceBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useState } from "react";

import Alert from "./Alert";
import "./MaintenanceBanner.scss";

interface MaintenanceMode {
active: boolean;
Expand Down Expand Up @@ -33,8 +34,13 @@ export const MaintenanceBanner: React.FC = () => {
return (
<>
{maintenanceMode.active ? (
<div className="usa-site-alert usa-site-alert--emergency usa-site-alert--no-heading border-top border-base-lighter">
<Alert type="emergency" role="alert">
<div className="maintenance-alert-background border-top border-base-lighter">
<Alert
type="emergency"
role="alert"
className={"margin-left-auto margin-right-auto"}
bodyClassName={"maintenance-alert-body"}
>
<strong>{maintenanceMode.header || "SimpleReport alert:"}</strong>{" "}
{maintenanceMode.message}
</Alert>
Expand Down
6 changes: 0 additions & 6 deletions frontend/src/scss/base/_prime-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1148,12 +1148,6 @@ $results-dropdown-spacing: #{units(4)} - #{units(2)} - 22px - #{units(4)}; // he
box-shadow: inset 0 0 0 2px #c9c9c9 !important;
}

.usa-site-alert {
.usa-alert--emergency {
max-width: $site-max-width;
}
}

abbr.usa-hint.usa-hint--required {
text-decoration: none;
}
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/scss/settings/_prime-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,3 @@ $theme-color-prime-gray-light: color("gray-10");
$theme-color-prime-gray: color("gray-30");
$theme-color-prime-gray-dark: color("gray-60");
$theme-color-prime-gray-darkest: color("gray-70");

$site-max-width: 1200px;
Loading