Skip to content

Commit

Permalink
fix(markdowneditor): fix variant clash with codeeditor
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebarkmin committed Mar 3, 2021
1 parent 2af5d45 commit 54e0314
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
9 changes: 9 additions & 0 deletions src/MarkdownEditor.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Story, Meta } from "@storybook/react/types-6-0";
import { useState } from "react";

import { AutoGrid } from "./AutoGrid";
import { MarkdownEditor, MarkdownEditorProps } from "./MarkdownEditor";

export default {
Expand Down Expand Up @@ -41,3 +42,11 @@ def test():
pass
\`\`\``,
};

export const MultipleEditorsWithDifferentHeights = () => (
<AutoGrid gap="standard">
<MarkdownEditor variant="outlined" height="100px" />
<MarkdownEditor variant="outlined" height="500px" />
<MarkdownEditor variant="outlined" height="auto" />
</AutoGrid>
);
15 changes: 3 additions & 12 deletions src/MarkdownEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const MarkdownEditor = ({
value = "",
onChange = () => {},
onBlur = () => {},
height = "400px",
height = "auto",
locale = defaultLocale,
...props
}: MarkdownEditorProps) => {
Expand All @@ -37,16 +37,7 @@ export const MarkdownEditor = ({
}

return (
<Box
position="relative"
css={(theme) => css`
border-radius: ${theme.radii.small};
padding: ${theme.space.xsmall} ${theme.space.xxsmall};
border-color: ${theme.colors.neutral["100"]};
border-style: solid;
border-width: ${theme.borderWidths.standard};
`}
>
<Box position="relative">
<ButtonSecondary
tone="accent"
onClick={() => setIsPreview((p) => !p)}
Expand Down Expand Up @@ -80,7 +71,7 @@ export const MarkdownEditor = ({
font-size: 90%;
}
.cm-strong {
font-size: 140%;
font-size: 100%;
}
`}
/>
Expand Down
10 changes: 5 additions & 5 deletions src/__snapshots__/MarkdownEditor.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ exports[`should match snapshot 1`] = `
-webkit-transition: all 0.2s ease;
transition: all 0.2s ease;
position: relative;
border-radius: 4px;
padding: 8px 4px;
border-color: #E4E7EB;
border-style: solid;
border-width: 1px;
}
.emotion-3 {
Expand Down Expand Up @@ -150,6 +145,11 @@ exports[`should match snapshot 1`] = `
transition: all 0.2s ease;
}
.emotion-7 .CodeMirror {
height: auto;
min-height: 60px;
}
<div>
<div
class="emotion-0 emotion-1"
Expand Down

0 comments on commit 54e0314

Please sign in to comment.