Skip to content
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

<EuiText> support for pre, pre code, code #654

Merged
merged 3 commits into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# [`master`](https://github.com/elastic/eui/tree/master)

- Add disabled prop to `EuiComboBoxOption` ([#650](https://github.com/elastic/eui/pull/650))
- Added export of sass theme variables in json format during compilation ([#642](https://github.com/elastic/eui/pull/642))
- Added `disabled` prop to `EuiComboBoxOption` ([#650](https://github.com/elastic/eui/pull/650))
- Added support for `<pre>` and `<code>` tags to `<EuiText>` ([#654](https://github.com/elastic/eui/pull/654))
- Added export of SASS theme variables in JSON format during compilation ([#642](https://github.com/elastic/eui/pull/642))

# [`0.0.40`](https://github.com/elastic/eui/tree/v0.0.40)

- Tweaked sizing, weights, color, line-heights, and added more levels to `EuiTitle` and `EuiText` ([#627](https://github.com/elastic/eui/pull/627))
- Add TypeScript type defitions for `EuiPortal`, `EuiText` and `EuiTitle` as well as the `calculatePopoverPosition` service ([#638](https://github.com/elastic/eui/pull/638))
- Added TypeScript type defitions for `EuiPortal`, `EuiText` and `EuiTitle` as well as the `calculatePopoverPosition` service ([#638](https://github.com/elastic/eui/pull/638))
- Grayed out labels for `disabled` controls ([#648](https://github.com/elastic/eui/pull/648))

**Bug fixes**
Expand All @@ -27,7 +28,7 @@
# [`0.0.38`](https://github.com/elastic/eui/tree/v0.0.38)

- Modified drop shadow intensities and color. ([#607](https://github.com/elastic/eui/pull/607))
- Added Sass color functions. Made `$euiColorWarning` color usage more accessible while still being "yellow". ([#628](https://github.com/elastic/eui/pull/628))
- Added SASS color functions. Made `$euiColorWarning` color usage more accessible while still being "yellow". ([#628](https://github.com/elastic/eui/pull/628))
- Removed extraneous `global_styling/mixins/_forms.scss` file and importing the correct files in the `filter_group.scss` and `combo_box.scss` files. ([#609](https://github.com/elastic/eui/pull/609))
- Added `isInvalid` prop to `EuiComboBox` ([#631](https://github.com/elastic/eui/pull/631))
- Added support for rejecting user input by returning `false` from the `onCreateOption` prop of `EuiComboBox` ([#631](https://github.com/elastic/eui/pull/631))
Expand Down
12 changes: 12 additions & 0 deletions src-docs/src/views/text/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ export default () => (
Far out in the uncharted backwaters of the unfashionable end of
the western spiral arm of the Galaxy lies a small unregarded
yellow sun.

When suddenly some wild JavaScript code appeared! <code>const whoa = &quot;!&quot;</code>
</p>

<pre>
<code>
const completelyUnexpected = &quot;the audacity!&quot;;
</code>
</pre>

<p>
That was close.
</p>

<blockquote>
Expand Down
27 changes: 26 additions & 1 deletion src/components/text/_text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
ul,
ol,
blockquote,
img {
img,
pre {
margin-bottom: convertToRem($baseLineHeightMultiplier * 3);
}

Expand Down Expand Up @@ -154,6 +155,30 @@
text-transform: uppercase;
}

pre {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are mostly copied over from _code_block.scss, we might prefer a mixin? Not sure.

height: 100%;
overflow: auto;
white-space: pre-wrap;
padding: $euiSize;
}

pre,
pre code {
display: block;
}

pre,
code {
background: $euiCodeBlockBackgroundColor;
color: $euiCodeBlockColor;
}

code {
line-height: $euiLineHeight;
font-family: $euiCodeFontFamily;
font-weight: $euiFontWeightRegular;
}

@include euiScaleText($euiFontSize);

&.euiText--small {
Expand Down
2 changes: 1 addition & 1 deletion src/components/text/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const EuiText = ({ size, color, children, className, ...rest }) => {
const classes = classNames(
'euiText',
textSizeToClassNameMap[size],
className
className,
);

let optionallyColoredText;
Expand Down