Skip to content

Commit 0a2a20a

Browse files
Constancecchaos
authored andcommitted
PR documentation feedback
Co-authored-by: Caroline Horn <[email protected]>
1 parent 04a1832 commit 0a2a20a

File tree

2 files changed

+10
-54
lines changed

2 files changed

+10
-54
lines changed

src-docs/src/views/html_id_generator/html_id_generator_example.js

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from 'react';
22

3-
import { renderToHtml } from '../../services';
4-
53
import { GuideSectionTypes } from '../../components';
64
import { EuiCode } from '../../../../src/components';
75

@@ -12,25 +10,20 @@ import { PrefixSufix } from './bothPrefixSuffix';
1210
import { UseGeneratedHtmlId } from './use_generated_html_id';
1311

1412
const htmlIdGeneratorSource = require('!!raw-loader!./html_id_generator');
15-
const htmlIdGeneratorHtml = renderToHtml(IdGenerator);
1613
const htmlIdGeneratorSnippet = ' htmlIdGenerator()()';
1714

1815
const htmlIdGeneratorPrefixSource = require('!!raw-loader!./html_id_generator_prefix');
19-
const htmlIdGeneratorPrefixHtml = renderToHtml(HtmlIdGeneratorPrefix);
2016
const htmlIdGeneratorPrefixSnippet = " htmlIdGenerator('prefix')()";
2117

2218
const HtmlIdGeneratorSuffixSource = require('!!raw-loader!./html_id_generator_suffix');
23-
const HtmlIdGeneratorSuffixHtml = renderToHtml(HtmlIdGeneratorSuffix);
2419
const suffixSnippet = " htmlIdGenerator()('suffix')";
2520

2621
const PrefixSufixSource = require('!!raw-loader!./bothPrefixSuffix');
27-
const PrefixSufixHtml = renderToHtml(PrefixSufix);
2822
const prefixSuffixSnippet = " htmlIdGenerator('prefix')('suffix')";
2923

3024
const UseGeneratedHtmlIdSource = require('!!raw-loader!./use_generated_html_id');
31-
const UseGeneratedHtmlIdHtml = renderToHtml(UseGeneratedHtmlId);
3225
const useGeneratedHtmlIdSnippet =
33-
"useGeneratedHtmlId({ prefix: 'Some', suffix: 'id', idFromProps: id })";
26+
'useGeneratedHtmlId({ prefix, suffix, idFromProps: id })';
3427

3528
export const HtmlIdGeneratorExample = {
3629
title: 'HTML ID generator',
@@ -41,10 +34,6 @@ export const HtmlIdGeneratorExample = {
4134
type: GuideSectionTypes.JS,
4235
code: htmlIdGeneratorSource,
4336
},
44-
{
45-
type: GuideSectionTypes.HTML,
46-
code: htmlIdGeneratorHtml,
47-
},
4837
],
4938
text: (
5039
<p>
@@ -66,10 +55,6 @@ export const HtmlIdGeneratorExample = {
6655
type: GuideSectionTypes.JS,
6756
code: htmlIdGeneratorPrefixSource,
6857
},
69-
{
70-
type: GuideSectionTypes.HTML,
71-
code: htmlIdGeneratorPrefixHtml,
72-
},
7358
],
7459
text: (
7560
<p>
@@ -87,10 +72,6 @@ export const HtmlIdGeneratorExample = {
8772
type: GuideSectionTypes.JS,
8873
code: HtmlIdGeneratorSuffixSource,
8974
},
90-
{
91-
type: GuideSectionTypes.HTML,
92-
code: HtmlIdGeneratorSuffixHtml,
93-
},
9475
],
9576
text: (
9677
<p>
@@ -108,10 +89,6 @@ export const HtmlIdGeneratorExample = {
10889
type: GuideSectionTypes.JS,
10990
code: PrefixSufixSource,
11091
},
111-
{
112-
type: GuideSectionTypes.HTML,
113-
code: PrefixSufixHtml,
114-
},
11592
],
11693
text: (
11794
<p>
@@ -129,10 +106,6 @@ export const HtmlIdGeneratorExample = {
129106
type: GuideSectionTypes.JS,
130107
code: UseGeneratedHtmlIdSource,
131108
},
132-
{
133-
type: GuideSectionTypes.HTML,
134-
code: UseGeneratedHtmlIdHtml,
135-
},
136109
],
137110
text: (
138111
<>
@@ -146,9 +119,9 @@ export const HtmlIdGeneratorExample = {
146119
<p>
147120
<EuiCode>useGeneratedHtmlId</EuiCode> optionally takes{' '}
148121
<EuiCode>suffix</EuiCode> and <EuiCode>prefix</EuiCode> parameters
149-
with the same behavior as above, as well as an{' '}
150-
<EuiCode>idFromProps</EuiCode> option for components that allow
151-
end-users to set their own custom IDs.
122+
producing similar results as <EuiCode>htmlIdGenerator</EuiCode>, as
123+
well as an <EuiCode>idFromProps</EuiCode> option for components that
124+
allow end-users to set their own custom IDs.
152125
</p>
153126
</>
154127
),

src-docs/src/views/html_id_generator/use_generated_html_id.js

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import React, { useState, Fragment } from 'react';
22

3-
import {
4-
EuiSwitch,
5-
EuiFlexGroup,
6-
EuiFlexItem,
7-
EuiSpacer,
8-
EuiCode,
9-
EuiFormRow,
10-
} from '../../../../src/components';
3+
import { EuiSwitch, EuiSpacer, EuiCode } from '../../../../src/components';
114

125
import { useGeneratedHtmlId } from '../../../../src/services';
136

@@ -19,21 +12,11 @@ export const UseGeneratedHtmlId = () => {
1912

2013
return (
2114
<Fragment>
22-
<EuiFlexGroup
23-
justifyContent="flexStart"
24-
gutterSize="m"
25-
alignItems="center"
26-
>
27-
<EuiFlexItem grow={false}>
28-
<EuiFormRow>
29-
<EuiSwitch
30-
label="Clicking me changes component state"
31-
checked={isChecked}
32-
onChange={onChange}
33-
/>
34-
</EuiFormRow>
35-
</EuiFlexItem>
36-
</EuiFlexGroup>
15+
<EuiSwitch
16+
label="Clicking me changes component state"
17+
checked={isChecked}
18+
onChange={onChange}
19+
/>
3720
<EuiSpacer size="xl" />
3821
<EuiCode>{generatedId} </EuiCode>
3922
</Fragment>

0 commit comments

Comments
 (0)