Skip to content

Commit 8196012

Browse files
committed
fix display of markdown generated code snippet in notification body
1 parent 0e7f782 commit 8196012

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

src/components/Notification/Notification.stories.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from "react";
2-
import { LoremIpsum } from "react-lorem-ipsum";
2+
import { LoremIpsum, loremIpsum } from "react-lorem-ipsum";
33
import { Meta, StoryFn } from "@storybook/react";
44

55
import { helpersArgTypes } from "../../../.storybook/helpers";
6-
import { Button, HtmlContentBlock, Notification, Spacing } from "../../../index";
6+
import { Button, HtmlContentBlock, Markdown, Notification, Spacing } from "../../../index";
77

88
export default {
99
title: "Components/Notification",
@@ -33,12 +33,26 @@ ExampleWithMessage.args = {
3333
export const ExampleWithChildren = TemplateFull.bind({});
3434
ExampleWithChildren.args = {
3535
children: (
36-
<HtmlContentBlock>
37-
<LoremIpsum p={1} avgSentencesPerParagraph={1} random={false} />
38-
<LoremIpsum p={1} avgSentencesPerParagraph={4} random={false} />
39-
</HtmlContentBlock>
36+
<>
37+
<HtmlContentBlock>
38+
<LoremIpsum p={1} avgSentencesPerParagraph={1} random={false} />
39+
<LoremIpsum p={1} avgSentencesPerParagraph={4} random={false} />
40+
</HtmlContentBlock>
41+
<br />
42+
<Markdown
43+
htmlContentBlockProps={{
44+
style: {
45+
maxHeight: "25vh",
46+
overflow: "auto",
47+
},
48+
}}
49+
>
50+
{"```\n" + loremIpsum({ random: false }) + "\n```"}
51+
</Markdown>
52+
</>
4053
),
4154
onDismiss: false, // workaround for undefined function in Storybook
55+
actions: [<></>],
4256
};
4357

4458
export const ExampleNeutralMessage = TemplateFull.bind({});

src/components/Notification/notification.scss

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
@use "sass:math";
44
@import "~@blueprintjs/core/src/components/toast/toast";
55

6+
.#{$ns}-toast-message {
7+
min-width: 0;
8+
}
9+
610
.#{$eccgui}-notification {
711
width: 100%;
812
min-width: math.div(4, 16) * 100vw;
@@ -69,13 +73,14 @@
6973
display: flex;
7074
align-items: baseline;
7175
justify-content: space-between;
72-
margin: -10px; // TODO: use blueprint var ofr toast padding here
76+
margin: -0.5 * $toast-margin;
7377
}
7478

7579
.#{$eccgui}-notification__messagebody {
7680
flex-grow: 1;
7781
flex-shrink: 1;
78-
padding: 10px; // TODO: use blueprint var ofr toast padding here
82+
min-width: 0;
83+
padding: 0.5 * $toast-margin;
7984
}
8085

8186
.#{$eccgui}-notification__actions {

0 commit comments

Comments
 (0)