-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
131 additions
and
32 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
app/assets/icons/x - large.svg → app/assets/icons/x-large.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,7 +96,7 @@ | |
} | ||
|
||
@media (max-width: 780px) { | ||
.button { | ||
.stampy-widget .button { | ||
width: 100%; | ||
} | ||
.widget-ask.fixed { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.global-banner { | ||
background-color: var(--colors-teal-500); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: var(--spacing-24); | ||
padding: var(--spacing-12) var(--spacing-40); | ||
} | ||
|
||
.global-banner .close { | ||
position: absolute; | ||
top: 20px; | ||
right: 20px; | ||
cursor: pointer; | ||
} | ||
|
||
@media (max-width: 780px) { | ||
.global-banner { | ||
flex-direction: column; | ||
padding-bottom: var(--spacing-32); | ||
} | ||
|
||
.global-banner .close { | ||
top: 8px; | ||
right: 8px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import {useEffect, useState} from 'react' | ||
import XLarge from '~/components/icons-generated/XLarge' | ||
import Button from '~/components/Button' | ||
import './global-banners.css' | ||
|
||
type GlobalBannerProps = { | ||
bannerId: string | ||
title: string | ||
action?: string | ||
actionLabel?: string | ||
} | ||
const GlobalBanner = ({bannerId, title, action, actionLabel}: GlobalBannerProps) => { | ||
const [showBanner, setShowBanner] = useState(false) | ||
const hideBanner = () => { | ||
localStorage.setItem(bannerId, 'hide') | ||
setShowBanner(false) | ||
} | ||
|
||
useEffect(() => { | ||
setShowBanner(localStorage?.getItem(bannerId) !== 'hide') | ||
}, [bannerId]) | ||
|
||
return ( | ||
showBanner && ( | ||
<div className="global-banner white"> | ||
<p className="small">{title}</p> | ||
{action && ( | ||
<Button | ||
action={action} | ||
className="secondary-alt small-bold" | ||
size="small" | ||
props={{target: '_blank', rel: 'noopener noreferrer'}} | ||
> | ||
{actionLabel} | ||
</Button> | ||
)} | ||
<XLarge fill="white" className="close" onClick={hideBanner} /> | ||
</div> | ||
) | ||
) | ||
} | ||
|
||
const GlobalBanners = () => ( | ||
<> | ||
<GlobalBanner | ||
bannerId="take-survey-1" | ||
title="Take AISafety.info’s 3 minute survey to help inform our strategy and priorities" | ||
action="https://79385avet9x.typeform.com/to/cyfXg3je" | ||
actionLabel="Take the survey" | ||
/> | ||
</> | ||
) | ||
export default GlobalBanners |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import type {SVGProps} from 'react' | ||
const SvgXLarge = (props: SVGProps<SVGSVGElement>) => ( | ||
<svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} fill="none" {...props}> | ||
<path | ||
fill="#AFB7C2" | ||
d="M4.646 18.646a.5.5 0 0 0 .708.708L12 12.707l6.646 6.647a.5.5 0 0 0 .708-.708L12.707 12l6.647-6.646a.5.5 0 0 0-.708-.708L12 11.293 5.354 4.646a.5.5 0 1 0-.708.708L11.293 12z" | ||
/> | ||
<svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} fill="#AFB7C2" {...props}> | ||
<path d="M4.646 18.646a.5.5 0 0 0 .708.708L12 12.707l6.646 6.647a.5.5 0 0 0 .708-.708L12.707 12l6.647-6.646a.5.5 0 0 0-.708-.708L12 11.293 5.354 4.646a.5.5 0 1 0-.708.708L11.293 12z" /> | ||
</svg> | ||
) | ||
export default SvgXLarge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters