Skip to content

Commit 5090547

Browse files
authored
Merge pull request #933 from brokewhale/fix-callout
feat: added close callout btn
2 parents 4acc50f + 1a85dee commit 5090547

File tree

2 files changed

+45
-18
lines changed

2 files changed

+45
-18
lines changed

components/WipCallout.tsx

+25-7
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,19 @@
1010
* `context` is not provided, it will display a default maintenance message.
1111
*/
1212
import type { ReactElement } from 'react';
13+
import { useState } from 'react';
14+
1315
interface Props {
1416
context?: string;
1517
}
1618
export function WipCallout({ context }: Props): ReactElement {
19+
const [closeCallout, setCloseCallout] = useState(false);
1720
return (
18-
<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">
21+
<div
22+
className={`custom-callouts nx-w-full nx-mt-6 nx-flex nx-justify-center nx-items-center nx-bg-white dark:nx-bg-black ${
23+
closeCallout && 'nx-hidden'
24+
}`}
25+
>
1926
<div className="nx-w-full nx-px-4 nx-text-center nx-font-medium nx-text-sm nx-text-left">
2027
{context ? (
2128
context
@@ -34,6 +41,12 @@ export function WipCallout({ context }: Props): ReactElement {
3441
</div>
3542
)}
3643
</div>
44+
<button
45+
className="callout-close-btn"
46+
onClick={() => setCloseCallout(true)}
47+
>
48+
x
49+
</button>
3750
</div>
3851
);
3952
}
@@ -46,11 +59,12 @@ export function InfoCallout({ context }: Props): ReactElement {
4659
context
4760
) : (
4861
<div className="nx-text-left">
49-
Interop is currently in <strong>active development</strong> and not yet ready for production use.
50-
The information provided here may change frequently.
62+
Interop is currently in <strong>active development</strong> and not
63+
yet ready for production use. The information provided here may
64+
change frequently.
5165
<p>
52-
We recommend checking back
53-
regularly for the most up-to-date information.
66+
We recommend checking back regularly for the most up-to-date
67+
information.
5468
</p>
5569
</div>
5670
)}
@@ -67,8 +81,12 @@ export function AltCallout({ context }: Props): ReactElement {
6781
context
6882
) : (
6983
<div className="nx-text-left">
70-
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.
71-
These features may experience stability issues, and we encourage feedback from our early users.
84+
The Alt-DA Mode feature is currently in <strong>Beta</strong> within
85+
the MIT-licensed OP Stack. Beta features are built and reviewed by
86+
the Optimism Collective’s core contributors, and provide developers
87+
with early access to highly requested configurations. These features
88+
may experience stability issues, and we encourage feedback from our
89+
early users.
7290
</div>
7391
)}
7492
</div>

styles/global.css

+20-11
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,39 @@ span.shasum code {
5454
}
5555

5656
div.custom-callouts {
57-
position: static;
58-
top: 45px;
59-
padding-left: 0;
60-
padding-right: 0;
61-
width: 100%;
57+
position: -webkit-sticky;
58+
position: sticky;
59+
top: 65px;
60+
padding: 5px;
6261
background-color: #fefce8;
6362
border: 2px solid #ffdc00;
63+
z-index: 9999;
6464
border-radius: 4px;
6565
}
6666
a.callout-link {
6767
color: #006be6;
6868
text-decoration: underline;
6969
}
7070

71-
@media only screen and (max-width: 767px) {
72-
div.custom-callouts {
73-
top: 105px;
74-
}
75-
}
76-
7771
html.dark div.custom-callouts {
7872
color: white;
7973
background-color: #432c11;
8074
}
8175
html.dark a.callout-link {
8276
color: #008ae6;
8377
}
78+
.callout-close-btn {
79+
position: absolute;
80+
top: -9px;
81+
right: -9px;
82+
width: 25px;
83+
height: 25px;
84+
border-radius: 50%;
85+
background-color: #fefce8;
86+
display: flex;
87+
justify-content: center;
88+
align-items: center;
89+
border: 2px solid #ffdc00;
90+
color: red;
91+
font-size: 14px;
92+
}

0 commit comments

Comments
 (0)