-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiMarkdownEditor] Improving markdown format styles #3534
Merged
elizabetdev
merged 7 commits into
elastic:feature/markdown-editor
from
elizabetdev:markdown-format-styles
Jul 3, 2020
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
85ce0e8
Improving markdown format styles
elizabetdev dcfbffd
Merge remote-tracking branch 'upstream/feature/markdown-editor' into …
elizabetdev dffc88c
Transforming px to em
elizabetdev 596b004
Renaming variable
elizabetdev e480bb3
Merge remote-tracking branch 'upstream/feature/markdown-editor' into …
elizabetdev bbf06b2
Adding descriptions and alpha values
elizabetdev 330a8b7
hr more similar to EuiHorizontalRule
elizabetdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,41 +9,33 @@ | |
// 7. Tables | ||
// 8. Code | ||
|
||
// Functions | ||
// Note: The inlined base font size is set in common/functions/font.js. It should match $euiMdFontSize. | ||
$euiDefaultFontSize: 14px; | ||
$browserDefaultFontSize: 16px; | ||
|
||
@function canvasToEm($size) { | ||
@return #{$size / $euiDefaultFontSize}em; | ||
// We're setting a function o transform px in em | ||
// because it's easier to think in px | ||
@function em($pixels, $context: $browserDefaultFontSize) { | ||
@return #{$pixels/$context}em; | ||
} | ||
|
||
.euiMarkdownFormat { | ||
@include euiFont; | ||
@include euiText; | ||
|
||
// Font size variables | ||
$euiMarkdownFontSizeS: canvasToEm(12px); | ||
$euiMarkdownFontSize: canvasToEm(14px); | ||
$euiMarkdownFontSizeL: canvasToEm(20px); | ||
$euiMarkdownFontSizeXL: canvasToEm(28px); | ||
$euiMarkdownFontSizeXXL: canvasToEm(36px); | ||
|
||
// Spacing variables | ||
$euiMarkdownSizeL: canvasToEm(24px); | ||
$euiMarkdownSize: canvasToEm(16px); | ||
$euiMarkdownSizeS: canvasToEm(12px); | ||
$euiMarkdownSizeXS: canvasToEm(8px); | ||
$euiMarkdownSizeXXS: canvasToEm(4px); | ||
|
||
// Grayscale variables | ||
$euiMarkdownAlphaLightestShade: rgba($euiColorFullShade, .05); | ||
$euiMarkdownAlphaLightShade: rgba($euiColorFullShade, .15); | ||
$euiMarkdownAlphaDarkShade: rgba($euiColorFullShade, .65); | ||
|
||
// Reverse grayscale for opposite of theme | ||
$euiMarkdownAlphaLightestShadeReversed: rgba($euiColorEmptyShade, .05); | ||
$euiMarkdownAlphaLightShadeReversed: rgba($euiColorEmptyShade, .15); | ||
$euiMarkdownAlphaDarkShadeReversed: rgba($euiColorEmptyShade, .65); | ||
$euiMarkdownFontSizeXS: em(12px); | ||
$euiMarkdownFontSizeS: em(14px); | ||
$euiMarkdownFontSize: em(16px); | ||
$euiMarkdownFontSizeM: em(18px); | ||
$euiMarkdownFontSizeL: em(20px); | ||
$euiMarkdownFontSizeXL: em(28px); | ||
$euiMarkdownFontSizeXXL: em(36px); | ||
|
||
$euiMarkdownSizeXXS: em(4px); | ||
$euiMarkdownSizeXS: em(8px); | ||
$euiMarkdownSizeS: em(12px); | ||
$euiMarkdownSize: em(16px); | ||
$euiMarkdownSizeL: em(24px); | ||
|
||
|
||
|
||
> *:first-child { | ||
// sass-lint:disable-block no-important | ||
|
@@ -79,7 +71,7 @@ $euiDefaultFontSize: 14px; | |
h5, | ||
h6 { | ||
margin-top: 0; | ||
margin-bottom: $euiMarkdownSizeXS; | ||
margin-bottom: $euiMarkdownSize; | ||
} | ||
|
||
h1 { | ||
|
@@ -107,13 +99,13 @@ $euiDefaultFontSize: 14px; | |
} | ||
|
||
h5 { | ||
font-size: $euiMarkdownFontSize; | ||
font-size: $euiMarkdownFontSizeS; | ||
line-height: 1.142857em; | ||
font-weight: 700; | ||
} | ||
|
||
h6 { | ||
font-size: $euiMarkdownFontSizeS; | ||
font-size: $euiMarkdownFontSizeXS; | ||
line-height: 1.333333em; | ||
font-weight: 700; | ||
text-transform: uppercase; | ||
|
@@ -122,7 +114,7 @@ $euiDefaultFontSize: 14px; | |
h1, | ||
h2 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get the header values closer to |
||
padding-bottom: .3em; | ||
border-bottom: 1px solid $euiMarkdownAlphaLightShade; | ||
border-bottom: $euiBorderThin; | ||
} | ||
|
||
// 3. Images | ||
|
@@ -135,11 +127,7 @@ $euiDefaultFontSize: 14px; | |
// 4. Blockquotes | ||
blockquote { | ||
padding: 0 1em; | ||
border-left: $euiMarkdownSizeXXS solid $euiMarkdownAlphaLightShade; | ||
} | ||
|
||
&--reversed blockquote { | ||
border-left-color: $euiMarkdownAlphaLightShadeReversed; | ||
border-left: $euiMarkdownSizeXXS solid $euiBorderColor; | ||
} | ||
|
||
// 5. Horizontal rules | ||
elizabetdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -149,7 +137,7 @@ $euiDefaultFontSize: 14px; | |
height: 2px; | ||
padding: 0; | ||
margin: $euiMarkdownSizeL 0; | ||
background-color: $euiMarkdownAlphaLightShade; | ||
background-color: $euiBorderColor; | ||
border: none; | ||
} | ||
|
||
|
@@ -234,7 +222,7 @@ $euiDefaultFontSize: 14px; | |
display: block; | ||
width: 100%; | ||
overflow: auto; | ||
border-left: 1px solid $euiMarkdownAlphaLightShade; | ||
border-left: 1px solid $euiBorderThin; | ||
border-spacing: 0; | ||
border-collapse: collapse; | ||
} | ||
|
@@ -246,49 +234,39 @@ $euiDefaultFontSize: 14px; | |
|
||
table th, | ||
table td { | ||
padding: $euiMarkdownSizeXXS $euiMarkdownSizeS; | ||
border-top: 1px solid $euiMarkdownAlphaLightShade; | ||
border-bottom: 1px solid $euiMarkdownAlphaLightShade; | ||
padding: $euiMarkdownSizeXXS $euiMarkdownSizeXS; | ||
border-top: $euiBorderThin; | ||
border-bottom: $euiBorderThin; | ||
|
||
&:last-child { | ||
border-right: 1px solid $euiMarkdownAlphaLightShade; | ||
border-right: $euiBorderThin; | ||
} | ||
} | ||
|
||
table tr { | ||
background-color: transparent; | ||
border-top: 1px solid $euiMarkdownAlphaLightShade; | ||
border-top: $euiBorderThin; | ||
} | ||
|
||
// 8. Code | ||
.euiMarkdownFormat__code { | ||
// the markdown editor adds a EuiCodeBlock when consumers specify the language | ||
// when no language is specified it gets the .euiMarkdownFormat__code styles | ||
&__code { | ||
@include euiCodeFont; | ||
color: $euiCodeBlockColor; | ||
font-size: $euiFontSizeXS; | ||
font-size: $euiMarkdownFontSizeXS; | ||
padding: $euiMarkdownSizeXXS 0; | ||
margin-bottom: $euiMarkdownSizeXS; | ||
border-radius: $euiMarkdownSizeXXS; | ||
background: $euiCodeBlockBackgroundColor; | ||
} | ||
|
||
.euiMarkdownFormat__code::before, | ||
.euiMarkdownFormat__code::after { | ||
letter-spacing: -.2em; | ||
content: '\00a0'; | ||
} | ||
|
||
// code block | ||
pre .euiMarkdownFormat__code { | ||
// default styles for code blocks | ||
pre &__code { | ||
snide marked this conversation as resolved.
Show resolved
Hide resolved
|
||
display: block; | ||
padding: $euiSizeL; | ||
padding: $euiMarkdownFontSizeL; | ||
overflow: visible; | ||
line-height: inherit; | ||
word-wrap: normal; | ||
white-space: pre; | ||
} | ||
|
||
pre .euiMarkdownFormat__code::before, | ||
pre .euiMarkdownFormat__code::after { | ||
content: normal; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We likely have a decision to make here. The alpha values are used because Canvas displays markdown on backgrounds of various colors. We can say that Canvas uses it's own styling, or we support it here. Do you have any opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should support these scenarios.