Skip to content

Commit 3cacf0a

Browse files
committed
improved joyride fix message and inline message paddings
1 parent 3590389 commit 3cacf0a

File tree

2 files changed

+34
-24
lines changed

2 files changed

+34
-24
lines changed

library/src/components/inlinemessage/InlineMessage.tsx

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ export default function InlineMessage({
2323
message,
2424
display = "block",
2525
openingDirection = "topdown",
26+
removable = true,
2627
}: {
2728
message: Message
2829
display?: "inline-block" | "block"
2930
openingDirection?: OpeningDirection
31+
removable?: boolean
3032
}) {
3133
const [open, setOpen] = useState(true)
3234
const [msg, setMessage] = useState(message)
@@ -121,6 +123,8 @@ export default function InlineMessage({
121123
borderRadius: "4px",
122124
color: textColor,
123125
padding: "2px",
126+
paddingLeft: "6px",
127+
paddingRight: "6px",
124128
transition: "all 0.25s ease-in-out",
125129
boxSizing: "border-box",
126130
overflow: "hidden",
@@ -138,23 +142,26 @@ export default function InlineMessage({
138142
}}
139143
>
140144
{msg?.text ?? ""}
141-
<Button
142-
appearance={closeBtnAppearance}
143-
style={{
144-
borderRadius: "100%",
145-
userSelect: "none",
146-
display: "flex",
147-
justifyContent: "center",
148-
alignItems: "center",
149-
height: "20px",
150-
width: "20px",
151-
padding: "0px",
152-
color: textColor,
153-
}}
154-
onClick={() => setOpen(false)}
155-
>
156-
x
157-
</Button>
145+
{removable && (
146+
<Button
147+
appearance={closeBtnAppearance}
148+
style={{
149+
borderRadius: "100%",
150+
userSelect: "none",
151+
display: "flex",
152+
justifyContent: "center",
153+
alignItems: "center",
154+
height: "20px",
155+
width: "20px",
156+
padding: "0px",
157+
color: textColor,
158+
marginLeft: "4px",
159+
}}
160+
onClick={() => setOpen(false)}
161+
>
162+
x
163+
</Button>
164+
)}
158165
</div>
159166
</div>
160167
</div>

showcase/src/components/showcase/wrapper/JoyrideShowcase.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@ function JoyrideShowcase(props: ShowcaseProps) {
1616
const example = (
1717
<>
1818
<InlineMessage
19+
removable={true}
1920
message={{
2021
text: (
21-
<>
22+
<div>
2223
If you get the error &apos;global is not
23-
defined&apos; you have to add the following: &apos;
24-
<pre>
25-
if (!window.global) window.global = window
26-
</pre>
27-
&apos;
28-
</>
24+
defined&apos; you have to add the following:
25+
<br></br>
26+
<div>
27+
<pre>
28+
if (!window.global) window.global = window
29+
</pre>
30+
</div>
31+
</div>
2932
),
3033
urgency: "warning",
3134
}}

0 commit comments

Comments
 (0)