Skip to content

feat: added close callout btn #933

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

Merged
merged 1 commit into from
Oct 3, 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
32 changes: 25 additions & 7 deletions components/WipCallout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@
* `context` is not provided, it will display a default maintenance message.
*/
import type { ReactElement } from 'react';
import { useState } from 'react';

interface Props {
context?: string;
}
export function WipCallout({ context }: Props): ReactElement {
const [closeCallout, setCloseCallout] = useState(false);
return (
<div className="custom-callouts nx-w-full nx-mt-6 nx-flex nx-justify-center nx-items-center nx-bg-white dark:nx-bg-black">
<div
className={`custom-callouts nx-w-full nx-mt-6 nx-flex nx-justify-center nx-items-center nx-bg-white dark:nx-bg-black ${
closeCallout && 'nx-hidden'
}`}
>
<div className="nx-w-full nx-px-4 nx-text-center nx-font-medium nx-text-sm nx-text-left">
{context ? (
context
Expand All @@ -34,6 +41,12 @@ export function WipCallout({ context }: Props): ReactElement {
</div>
)}
</div>
<button
className="callout-close-btn"
onClick={() => setCloseCallout(true)}
>
x
</button>
</div>
);
}
Expand All @@ -46,11 +59,12 @@ export function InfoCallout({ context }: Props): ReactElement {
context
) : (
<div className="nx-text-left">
Interop is currently in <strong>active development</strong> and not yet ready for production use.
The information provided here may change frequently.
Interop is currently in <strong>active development</strong> and not
yet ready for production use. The information provided here may
change frequently.
<p>
We recommend checking back
regularly for the most up-to-date information.
We recommend checking back regularly for the most up-to-date
information.
</p>
</div>
)}
Expand All @@ -67,8 +81,12 @@ export function AltCallout({ context }: Props): ReactElement {
context
) : (
<div className="nx-text-left">
The Alt-DA Mode feature is currently in <strong>Beta</strong> within the MIT-licensed OP Stack. Beta features are built and reviewed by the Optimism Collective’s core contributors, and provide developers with early access to highly requested configurations.
These features may experience stability issues, and we encourage feedback from our early users.
The Alt-DA Mode feature is currently in <strong>Beta</strong> within
the MIT-licensed OP Stack. Beta features are built and reviewed by
the Optimism Collective’s core contributors, and provide developers
with early access to highly requested configurations. These features
may experience stability issues, and we encourage feedback from our
early users.
</div>
)}
</div>
Expand Down
31 changes: 20 additions & 11 deletions styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,39 @@ span.shasum code {
}

div.custom-callouts {
position: static;
top: 45px;
padding-left: 0;
padding-right: 0;
width: 100%;
position: -webkit-sticky;
position: sticky;
top: 65px;
padding: 5px;
background-color: #fefce8;
border: 2px solid #ffdc00;
z-index: 9999;
border-radius: 4px;
}
a.callout-link {
color: #006be6;
text-decoration: underline;
}

@media only screen and (max-width: 767px) {
div.custom-callouts {
top: 105px;
}
}

html.dark div.custom-callouts {
color: white;
background-color: #432c11;
}
html.dark a.callout-link {
color: #008ae6;
}
.callout-close-btn {
position: absolute;
top: -9px;
right: -9px;
width: 25px;
height: 25px;
border-radius: 50%;
background-color: #fefce8;
display: flex;
justify-content: center;
align-items: center;
border: 2px solid #ffdc00;
color: red;
font-size: 14px;
}
Loading