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

[Emotion] Convert EuiText, EuiTextAlign, and EuiTextColor #5895

Merged
merged 57 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
019bbe2
Convert .euiText CSS to Emotion
cee-chen May 9, 2022
cad7f03
[misc] Fix EuiLink theme params to match other files
cee-chen May 9, 2022
cfc84c3
Convert constrainedWidth modifier CSS to Emotion
cee-chen May 9, 2022
dbce67a
Add `customScale` option to typography functions
cee-chen May 10, 2022
ec2cfd2
Add start of euiScaleText conversion + remove sizes class names
cee-chen May 10, 2022
32cce3e
Convert more of euiScaleText, + add unit tests
cee-chen May 10, 2022
969b33b
Convert more of euiScaleText + simplify `code` scale
cee-chen May 10, 2022
2a5a25c
Convert remaining euiScaleText headings logic/math to JS
cee-chen May 10, 2022
b515f3b
Updoot millions of downstream snapshots/tests
cee-chen May 10, 2022
b9e149d
Convert remaining euiMarkDownFormat styling in _text.scss to its own …
cee-chen May 11, 2022
2402762
Remove _text.scss
cee-chen May 11, 2022
40bc9f6
Convert EuiTextAlign to Emotion
cee-chen May 11, 2022
7d7ef9f
[EuiTextAlign] Opinionated: Remove className entirely
cee-chen May 11, 2022
7b6281d
Convert EuiTextColor to Emotion
cee-chen May 11, 2022
d9d7546
[EuiTextColor] Opinionated: Remove classNames entirely
cee-chen May 11, 2022
40c5f74
Update downstream snapshots
cee-chen May 11, 2022
59d8695
Remove all EuiText Sass
cee-chen May 11, 2022
e66e8c1
Add changelog
cee-chen May 11, 2022
d95cb50
[PR feedback] EuiMarkdownFormat helper naming
cee-chen May 17, 2022
4a8118b
[PR feedback] Fix `useEuiFontSize` code snippet w/ new options obj
cee-chen May 17, 2022
fa849f0
[PR feedback] functions/typography.ts param docblock
cee-chen May 17, 2022
996bd06
[PR feedback] Restore $euiTextConstrainedMaxWidth
cee-chen May 17, 2022
9dd2e92
Add optional `cloneElement` prop to all EuiText components
cee-chen May 17, 2022
e17f048
Update downstream snapshots from previous commit
cee-chen May 17, 2022
aa0b2e2
[Feedback] Clarify cloneElement prop documentation, specify default v…
cee-chen May 18, 2022
78ebe1a
[PR feedback] Remove cloneElement prop from EuiText
cee-chen May 19, 2022
5fa91e7
[EuiEmptyPrompt] Cleanup usage of EuiText
May 19, 2022
cfc1471
[PR feedback] docs/copy
cee-chen May 19, 2022
978033f
[PR feedback] Snapshot hints
cee-chen May 19, 2022
c4d9d43
[PR feedback] Add wiki guidelines for emotion tests
cee-chen May 19, 2022
c7e0a1d
Fix EuiMarkdown border colors
cee-chen May 19, 2022
d14aaaa
[PR feedback] Copy
cee-chen May 19, 2022
848de51
Rename euiTheme.colors.subdued to subduedText
cee-chen May 19, 2022
9e62bac
[PR feedback] EuiText code/pre styles
constancecchen May 19, 2022
32690fa
[PR feedback] euiTextConstrainedMaxWidth
constancecchen May 19, 2022
a1d2c18
[PR feedback] docblocks
cee-chen May 19, 2022
141c85b
[PR feedback] useEuiFontSize code snippet formatting
cee-chen May 19, 2022
1a9dd92
[PR feedback] Tweak code block background color
cee-chen May 19, 2022
e9c944f
[PR feedback] Misc style fixes/tweaks
cee-chen May 19, 2022
edc74ab
Add blockquote font as familySerif theme variable
cee-chen May 19, 2022
49739f7
[PR feedback] Combine h2 margin styles with :not
cee-chen May 20, 2022
02e0570
Squash various :first-child warnings created by Emotion
cee-chen May 20, 2022
bdbcc81
[PR feedback] :last-child margin bottom changes
cee-chen May 20, 2022
dc9975e
Update all downstream CSS snapshots
cee-chen May 20, 2022
cdf9d95
Merge remote-tracking branch 'upstream/main' into emotion/eui-text
cee-chen May 20, 2022
69b8840
Update src/components/text/text.styles.ts
constancecchen May 23, 2022
44e9e2f
[PR feedback] `font.familySerif` documentation
cee-chen May 23, 2022
b5cd186
Revert "[PR feedback] :last-child margin bottom changes"
cee-chen May 23, 2022
0772116
Ensure margin top/bottoms are on the 4px grid / use euiSizes
cee-chen May 23, 2022
beff872
Merge remote-tracking branch 'upstream/main' into emotion/eui-text
cee-chen May 23, 2022
4cc47cb
Fix underlying grid lines to 4px in Text scaling demo
May 24, 2022
bf79fe4
[PR feedback] Revert 996bd06
cee-chen May 24, 2022
f7c323a
[PR feedback] Add Emotion `euiTextColor-customColor` className
cee-chen May 24, 2022
1af1c89
Merge branch 'main' into emotion/eui-text
cee-chen May 24, 2022
9653bb6
Merge branch 'elastic:main' into emotion/eui-text
constancecchen May 25, 2022
354566d
[PR feedback] changelog
constancecchen May 26, 2022
30c1727
Merge branch 'main' into emotion/eui-text
cee-chen May 26, 2022
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
10 changes: 1 addition & 9 deletions src-docs/src/views/text/_text_scaling.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
// sass-lint:disable no-important
.guideDemo__textLines {
background-image: linear-gradient($euiFocusBackgroundColor 1px, transparent 1px);
background-size: 100% $euiFontSizeXS;
background-size: 100% $euiSizeXS;
background-position-y: -1px;

> * {
background-color: $euiColorHighlight;
}

&[class*='--small'] {
background-size: 100% $euiFontSizeS / 2;
}

&[class*='--extraSmall'] {
background-size: 100% $euiFontSizeXS / 2;
}
}
6 changes: 6 additions & 0 deletions src-docs/src/views/text/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ export const textColorConfig = () => {
hidden: false,
};

propsToUse.color = {
...propsToUse.color,
type: PropTypes.String,
value: 'default',
};

const setGhostBackground = {
color: 'ghost',
};
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/theme/_props.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function getType(type: any, euiTheme: EuiThemeComputed<{}>) {
<span
css={css`
font-weight: ${euiTheme.font.weight.light};
color: ${euiTheme.colors.subdued};
color: ${euiTheme.colors.subduedText};
`}
>
{humanizeType(type.custom.origin.type)}
Expand Down
18 changes: 18 additions & 0 deletions src-docs/src/views/theme/customizing/_typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default ({ onThemeUpdate }) => {

const fontFamilies = fontClone.family.split(',');
const codeFontFamilies = fontClone.familyCode.split(',');
const serifFontFamilies = fontClone.familySerif.split(',');

return (
<div>
Expand Down Expand Up @@ -120,6 +121,23 @@ export default ({ onThemeUpdate }) => {

<EuiSpacer />

<ThemeValue
property={'font'}
type={baseProps.familySerif}
name={'familySerif'}
value={serifFontFamilies[0]}
onUpdate={(value) => {
const out = [...serifFontFamilies];
out.splice(0, 1, value);
updateFont('familySerif', out.join(','));
}}
stringProps={{
style: { width: 200 },
}}
/>

<EuiSpacer />

<ThemeValue
property={'font'}
type={baseProps.featureSettings}
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/theme/customizing/_values.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const ThemeValue: FunctionComponent<ThemeValue> = ({
<span
css={css`
font-weight: ${euiTheme.font.weight.light};
color: ${euiTheme.colors.subdued};
color: ${euiTheme.colors.subduedText};
`}
>
: {humanizeType(type.custom.origin.type)}
Expand Down
35 changes: 30 additions & 5 deletions src-docs/src/views/theme/typography/_typography_js.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
EuiBasicTable,
EuiButtonGroup,
EuiCode,
EuiCodeBlock,
EuiDescribedFormGroup,
EuiPanel,
EuiSpacer,
Expand Down Expand Up @@ -72,6 +73,22 @@ export const FontJS = () => {
snippetLanguage="emotion"
/>

<ThemeExample
title={<code>euiTheme.font.familySerif</code>}
description={getDescription(baseProps.familySerif)}
example={
<p
css={css`
font-family: ${euiTheme.font.familySerif};
`}
>
{euiTheme.font.familySerif}
</p>
}
snippet={'font-family: ${euiTheme.font.familySerif};'}
snippetLanguage="emotion"
/>

<ThemeExample
title={<code>euiTheme.font.featureSettings</code>}
description={getDescription(baseProps.featureSettings)}
Expand Down Expand Up @@ -249,13 +266,17 @@ export const FontScaleValuesJS = () => {
return {
id: scale,
value: `useEuiFontSize('${scale}'${
measurementSelected !== 'rem' ? `, '${measurementSelected}'` : ''
measurementSelected !== 'rem'
? `,\n { measurement: '${measurementSelected}' }\n`
: ''
cchaos marked this conversation as resolved.
Show resolved Hide resolved
})`,
size: `${
euiFontSize(scale, euiTheme, measurementSelected).fontSize
euiFontSize(scale, euiTheme, { measurement: measurementSelected })
.fontSize
}`,
lineHeight: `${
euiFontSize(scale, euiTheme, measurementSelected).lineHeight
euiFontSize(scale, euiTheme, { measurement: measurementSelected })
.lineHeight
}`,
index,
};
Expand All @@ -269,7 +290,9 @@ export const FontScaleValuesJS = () => {
render: (sample, item) => (
<div
css={css`
${euiFontSize(item.id, euiTheme, measurementSelected)}
${euiFontSize(item.id, euiTheme, {
measurement: measurementSelected,
})}
`}
>
The quick brown fox jumped over the blue moon to catch a snail
Expand All @@ -285,7 +308,9 @@ export const FontScaleValuesJS = () => {
width: 'auto',
valign: 'baseline',
render: (value: React.ReactNode) => (
<EuiCode language="css">{value}</EuiCode>
<EuiCodeBlock language="js" paddingSize="s">
{value}
</EuiCodeBlock>
),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ exports[`EuiAccordion props isLoadingMessage is rendered 1`] = `
role="progressbar"
/>
<div
class="euiText euiText--small"
class="euiText css-1tf7qyo-euiText-s"
>
<p>
Please wait
Expand Down
16 changes: 4 additions & 12 deletions src/components/call_out/__snapshots__/call_out.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ exports[`EuiCallOut is rendered 1`] = `
data-test-subj="test subject string"
>
<div
class="euiText euiText--small css-1vr4wuv-euiCallOut__description"
class="euiText css-1cp7n4r-euiText-s-euiTextColor-default-euiCallOut__description"
>
<div
class="euiTextColor euiTextColor--default"
>
Content
</div>
Content
</div>
</div>
`;
Expand Down Expand Up @@ -100,13 +96,9 @@ exports[`EuiCallOut props title is rendered 1`] = `
Title
</p>
<div
class="euiText euiText--small css-1vr4wuv-euiCallOut__description"
class="euiText css-1cp7n4r-euiText-s-euiTextColor-default-euiCallOut__description"
>
<div
class="euiTextColor euiTextColor--default"
>
Content
</div>
Content
</div>
</div>
`;
Loading