@patternfly/react-core 4.200.2 → 4.201.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +13 -8
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +13 -8
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/umd/react-core.js +13 -8
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/CalendarMonth/CalendarMonth.tsx +15 -9
- package/src/components/CodeBlock/examples/CodeBlock.md +2 -195
- package/src/components/CodeBlock/examples/CodeBlockBasic.tsx +59 -0
- package/src/components/CodeBlock/examples/CodeBlockExpandable.tsx +88 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.201.2",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.52.2",
|
|
38
|
+
"@patternfly/react-styles": "^4.51.2",
|
|
39
|
+
"@patternfly/react-tokens": "^4.53.2",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c7164830706215f812e1982fdad6c9903229e71f"
|
|
64
64
|
}
|
|
@@ -45,7 +45,7 @@ export interface CalendarFormat {
|
|
|
45
45
|
|
|
46
46
|
export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
|
|
47
47
|
/** Month/year to base other dates around */
|
|
48
|
-
date
|
|
48
|
+
date?: Date;
|
|
49
49
|
/** Callback when date is selected */
|
|
50
50
|
onChange?: (date: Date) => void;
|
|
51
51
|
/** Functions that returns if a date is valid and selectable */
|
|
@@ -60,8 +60,8 @@ export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTML
|
|
|
60
60
|
const yearFormat = (date: Date) => date.getFullYear();
|
|
61
61
|
|
|
62
62
|
const buildCalendar = (year: number, month: number, weekStart: number, validators: ((date: Date) => boolean)[]) => {
|
|
63
|
-
const
|
|
64
|
-
const firstDayOfWeek = new Date(
|
|
63
|
+
const defaultDate = new Date(year, month);
|
|
64
|
+
const firstDayOfWeek = new Date(defaultDate);
|
|
65
65
|
firstDayOfWeek.setDate(firstDayOfWeek.getDate() - firstDayOfWeek.getDay() + weekStart);
|
|
66
66
|
// We will always show 6 weeks like google calendar
|
|
67
67
|
// Assume we just want the numbers for now...
|
|
@@ -90,7 +90,7 @@ export const isValidDate = (date: Date) => Boolean(date && !isNaN(date as any));
|
|
|
90
90
|
const today = new Date();
|
|
91
91
|
|
|
92
92
|
export const CalendarMonth = ({
|
|
93
|
-
date: dateProp
|
|
93
|
+
date: dateProp,
|
|
94
94
|
locale = undefined,
|
|
95
95
|
monthFormat = date => date.toLocaleDateString(locale, { month: 'long' }),
|
|
96
96
|
weekdayFormat = date => date.toLocaleDateString(locale, { weekday: 'narrow' }),
|
|
@@ -110,6 +110,7 @@ export const CalendarMonth = ({
|
|
|
110
110
|
}: CalendarProps) => {
|
|
111
111
|
const longMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(monthNum => new Date(1990, monthNum)).map(monthFormat);
|
|
112
112
|
const [isSelectOpen, setIsSelectOpen] = React.useState(false);
|
|
113
|
+
const [selectedDate, setSelectedDate] = React.useState(new Date(dateProp));
|
|
113
114
|
// eslint-disable-next-line prefer-const
|
|
114
115
|
let [focusedDate, setFocusedDate] = React.useState(new Date(dateProp));
|
|
115
116
|
if (!isValidDate(focusedDate)) {
|
|
@@ -118,7 +119,7 @@ export const CalendarMonth = ({
|
|
|
118
119
|
const [hoveredDate, setHoveredDate] = React.useState(new Date(focusedDate));
|
|
119
120
|
const focusRef = React.useRef<HTMLButtonElement>();
|
|
120
121
|
const [hiddenMonthId] = React.useState(getUniqueId('hidden-month-span'));
|
|
121
|
-
const [shouldFocus, setShouldFocus] = React.useState(
|
|
122
|
+
const [shouldFocus, setShouldFocus] = React.useState(false);
|
|
122
123
|
|
|
123
124
|
const isValidated = (date: Date) => validators.every(validator => validator(date));
|
|
124
125
|
const focusedDateValidated = isValidated(focusedDate);
|
|
@@ -126,7 +127,8 @@ export const CalendarMonth = ({
|
|
|
126
127
|
if (!(isValidDate(dateProp) && isSameDate(focusedDate, dateProp))) {
|
|
127
128
|
setFocusedDate(dateProp);
|
|
128
129
|
}
|
|
129
|
-
}, [dateProp
|
|
130
|
+
}, [dateProp]);
|
|
131
|
+
|
|
130
132
|
useEffect(() => {
|
|
131
133
|
// When using header controls don't move focus
|
|
132
134
|
if (shouldFocus) {
|
|
@@ -136,7 +138,7 @@ export const CalendarMonth = ({
|
|
|
136
138
|
} else {
|
|
137
139
|
setShouldFocus(true);
|
|
138
140
|
}
|
|
139
|
-
}, [focusedDate
|
|
141
|
+
}, [focusedDate]);
|
|
140
142
|
|
|
141
143
|
const onMonthClick = (newDate: Date) => {
|
|
142
144
|
setFocusedDate(newDate);
|
|
@@ -275,7 +277,7 @@ export const CalendarMonth = ({
|
|
|
275
277
|
{week.map(({ date, isValid }, index) => {
|
|
276
278
|
const dayFormatted = dayFormat(date);
|
|
277
279
|
const isToday = isSameDate(date, today);
|
|
278
|
-
const isSelected = isValidDate(
|
|
280
|
+
const isSelected = isValidDate(selectedDate) && isSameDate(date, selectedDate);
|
|
279
281
|
const isFocused = isSameDate(date, focusedDate);
|
|
280
282
|
const isAdjacentMonth = date.getMonth() !== focusedDate.getMonth();
|
|
281
283
|
let isInRange = false;
|
|
@@ -312,7 +314,11 @@ export const CalendarMonth = ({
|
|
|
312
314
|
!isValid && styles.modifiers.disabled
|
|
313
315
|
)}
|
|
314
316
|
type="button"
|
|
315
|
-
onClick={() =>
|
|
317
|
+
onClick={() => {
|
|
318
|
+
setSelectedDate(date);
|
|
319
|
+
setFocusedDate(date);
|
|
320
|
+
onChange(date);
|
|
321
|
+
}}
|
|
316
322
|
onMouseOver={() => setHoveredDate(date)}
|
|
317
323
|
tabIndex={isFocused ? 0 : -1}
|
|
318
324
|
disabled={!isValid}
|
|
@@ -12,203 +12,10 @@ import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
|
|
|
12
12
|
|
|
13
13
|
### Basic
|
|
14
14
|
|
|
15
|
-
```
|
|
16
|
-
import React from 'react';
|
|
17
|
-
import { CodeBlock, CodeBlockAction, CodeBlockCode, ClipboardCopyButton, Button } from '@patternfly/react-core';
|
|
18
|
-
import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
|
|
19
|
-
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
|
|
20
|
-
|
|
21
|
-
class BasicCodeBlock extends React.Component {
|
|
22
|
-
constructor(props) {
|
|
23
|
-
super(props);
|
|
24
|
-
this.timer = null;
|
|
25
|
-
|
|
26
|
-
this.state = {
|
|
27
|
-
copied: false
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
this.clipboardCopyFunc = (event, text) => {
|
|
31
|
-
const clipboard = event.currentTarget.parentElement;
|
|
32
|
-
const el = document.createElement('textarea');
|
|
33
|
-
el.value = text.toString();
|
|
34
|
-
clipboard.appendChild(el);
|
|
35
|
-
el.select();
|
|
36
|
-
document.execCommand('copy');
|
|
37
|
-
clipboard.removeChild(el);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
this.onClick = (event, text) => {
|
|
41
|
-
if (this.timer) {
|
|
42
|
-
window.clearTimeout(this.timer);
|
|
43
|
-
this.setState({ copied: false });
|
|
44
|
-
}
|
|
45
|
-
this.clipboardCopyFunc(event, text);
|
|
46
|
-
this.setState({ copied: true }, () => {
|
|
47
|
-
this.timer = window.setTimeout(() => {
|
|
48
|
-
this.setState({ copied: false });
|
|
49
|
-
this.timer = null;
|
|
50
|
-
}, 1000);
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
const code = `apiVersion: helm.openshift.io/v1beta1/
|
|
57
|
-
kind: HelmChartRepository
|
|
58
|
-
metadata:
|
|
59
|
-
name: azure-sample-repo
|
|
60
|
-
spec:
|
|
61
|
-
connectionConfig:
|
|
62
|
-
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs`;
|
|
63
|
-
|
|
64
|
-
const actions = (
|
|
65
|
-
<React.Fragment>
|
|
66
|
-
<CodeBlockAction>
|
|
67
|
-
<ClipboardCopyButton
|
|
68
|
-
id="copy-button"
|
|
69
|
-
textId="code-content"
|
|
70
|
-
aria-label="Copy to clipboard"
|
|
71
|
-
onClick={e => this.onClick(e, code)}
|
|
72
|
-
exitDelay={600}
|
|
73
|
-
maxWidth="110px"
|
|
74
|
-
variant="plain"
|
|
75
|
-
>
|
|
76
|
-
{this.state.copied ? 'Successfully copied to clipboard!' : 'Copy to clipboard'}
|
|
77
|
-
</ClipboardCopyButton>
|
|
78
|
-
</CodeBlockAction>
|
|
79
|
-
<CodeBlockAction>
|
|
80
|
-
<Button variant="plain" aria-label="Play icon">
|
|
81
|
-
<PlayIcon />
|
|
82
|
-
</Button>
|
|
83
|
-
</CodeBlockAction>
|
|
84
|
-
</React.Fragment>
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
return (
|
|
88
|
-
<CodeBlock actions={actions}>
|
|
89
|
-
<CodeBlockCode id="code-content">{code}</CodeBlockCode>
|
|
90
|
-
</CodeBlock>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
15
|
+
```ts file="./CodeBlockBasic.tsx"
|
|
94
16
|
```
|
|
95
17
|
|
|
96
18
|
### Expandable
|
|
97
19
|
|
|
98
|
-
```
|
|
99
|
-
import React from 'react';
|
|
100
|
-
import {
|
|
101
|
-
CodeBlock,
|
|
102
|
-
CodeBlockAction,
|
|
103
|
-
CodeBlockCode,
|
|
104
|
-
ClipboardCopyButton,
|
|
105
|
-
ExpandableSection,
|
|
106
|
-
ExpandableSectionToggle,
|
|
107
|
-
Button
|
|
108
|
-
} from '@patternfly/react-core';
|
|
109
|
-
import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
|
|
110
|
-
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
|
|
111
|
-
|
|
112
|
-
class BasicCodeBlock extends React.Component {
|
|
113
|
-
constructor(props) {
|
|
114
|
-
super(props);
|
|
115
|
-
this.timer = null;
|
|
116
|
-
|
|
117
|
-
this.state = {
|
|
118
|
-
isExpanded: false,
|
|
119
|
-
copied: false
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
this.onToggle = isExpanded => {
|
|
123
|
-
this.setState({
|
|
124
|
-
isExpanded
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
this.clipboardCopyFunc = (event, text) => {
|
|
129
|
-
const clipboard = event.currentTarget.parentElement;
|
|
130
|
-
const el = document.createElement('textarea');
|
|
131
|
-
el.value = text.toString();
|
|
132
|
-
clipboard.appendChild(el);
|
|
133
|
-
el.select();
|
|
134
|
-
document.execCommand('copy');
|
|
135
|
-
clipboard.removeChild(el);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
this.onClick = (event, text) => {
|
|
139
|
-
if (this.timer) {
|
|
140
|
-
window.clearTimeout(this.timer);
|
|
141
|
-
this.setState({ copied: false });
|
|
142
|
-
}
|
|
143
|
-
this.clipboardCopyFunc(event, text);
|
|
144
|
-
this.setState({ copied: true }, () => {
|
|
145
|
-
this.timer = window.setTimeout(() => {
|
|
146
|
-
this.setState({ copied: false });
|
|
147
|
-
this.timer = null;
|
|
148
|
-
}, 1000);
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
render() {
|
|
154
|
-
const { isExpanded } = this.state;
|
|
155
|
-
|
|
156
|
-
const copyBlock = `apiVersion: helm.openshift.io/v1beta1/
|
|
157
|
-
kind: HelmChartRepository
|
|
158
|
-
metadata:
|
|
159
|
-
name: azure-sample-repo
|
|
160
|
-
spec:
|
|
161
|
-
connectionConfig:
|
|
162
|
-
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs`;
|
|
163
|
-
|
|
164
|
-
const code = `apiVersion: helm.openshift.io/v1beta1/
|
|
165
|
-
kind: HelmChartRepository
|
|
166
|
-
metadata:
|
|
167
|
-
name: azure-sample-repo`;
|
|
168
|
-
const expandedCode = `spec:
|
|
169
|
-
connectionConfig:
|
|
170
|
-
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs`;
|
|
171
|
-
|
|
172
|
-
const actions = (
|
|
173
|
-
<React.Fragment>
|
|
174
|
-
<CodeBlockAction>
|
|
175
|
-
<ClipboardCopyButton
|
|
176
|
-
id="copy-button"
|
|
177
|
-
textId="code-content"
|
|
178
|
-
aria-label="Copy to clipboard"
|
|
179
|
-
onClick={e => this.onClick(e, copyBlock)}
|
|
180
|
-
exitDelay={600}
|
|
181
|
-
maxWidth="110px"
|
|
182
|
-
variant="plain"
|
|
183
|
-
>
|
|
184
|
-
{this.state.copied ? 'Successfully copied to clipboard!' : 'Copy to clipboard'}
|
|
185
|
-
</ClipboardCopyButton>
|
|
186
|
-
</CodeBlockAction>
|
|
187
|
-
<CodeBlockAction>
|
|
188
|
-
<Button variant="plain" aria-label="Play icon">
|
|
189
|
-
<PlayIcon />
|
|
190
|
-
</Button>
|
|
191
|
-
</CodeBlockAction>
|
|
192
|
-
</React.Fragment>
|
|
193
|
-
);
|
|
194
|
-
return (
|
|
195
|
-
<CodeBlock actions={actions}>
|
|
196
|
-
<CodeBlockCode>
|
|
197
|
-
{code}
|
|
198
|
-
<ExpandableSection isExpanded={isExpanded} isDetached contentId="code-block-expand">
|
|
199
|
-
{expandedCode}
|
|
200
|
-
</ExpandableSection>
|
|
201
|
-
</CodeBlockCode>
|
|
202
|
-
<ExpandableSectionToggle
|
|
203
|
-
isExpanded={isExpanded}
|
|
204
|
-
onToggle={this.onToggle}
|
|
205
|
-
contentId="code-block-expand"
|
|
206
|
-
direction="up"
|
|
207
|
-
>
|
|
208
|
-
{isExpanded ? 'Show Less' : 'Show More'}
|
|
209
|
-
</ExpandableSectionToggle>
|
|
210
|
-
</CodeBlock>
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
20
|
+
```ts file="./CodeBlockExpandable.tsx"
|
|
214
21
|
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CodeBlock, CodeBlockAction, CodeBlockCode, ClipboardCopyButton, Button } from '@patternfly/react-core';
|
|
3
|
+
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
|
|
4
|
+
|
|
5
|
+
export const BasicCodeBlock: React.FunctionComponent = () => {
|
|
6
|
+
const [copied, setCopied] = React.useState(false);
|
|
7
|
+
|
|
8
|
+
const clipboardCopyFunc = (event, text) => {
|
|
9
|
+
const clipboard = event.currentTarget.parentElement;
|
|
10
|
+
const el = document.createElement('textarea');
|
|
11
|
+
el.value = text.toString();
|
|
12
|
+
clipboard.appendChild(el);
|
|
13
|
+
el.select();
|
|
14
|
+
document.execCommand('copy');
|
|
15
|
+
clipboard.removeChild(el);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const onClick = (event, text) => {
|
|
19
|
+
clipboardCopyFunc(event, text);
|
|
20
|
+
setCopied(true);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const code = `apiVersion: helm.openshift.io/v1beta1/
|
|
24
|
+
kind: HelmChartRepository
|
|
25
|
+
metadata:
|
|
26
|
+
name: azure-sample-repo0oooo00ooo
|
|
27
|
+
spec:
|
|
28
|
+
connectionConfig:
|
|
29
|
+
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs`;
|
|
30
|
+
|
|
31
|
+
const actions = (
|
|
32
|
+
<React.Fragment>
|
|
33
|
+
<CodeBlockAction>
|
|
34
|
+
<ClipboardCopyButton
|
|
35
|
+
id="copy-button"
|
|
36
|
+
textId="code-content"
|
|
37
|
+
aria-label="Copy to clipboard"
|
|
38
|
+
onClick={e => onClick(e, code)}
|
|
39
|
+
exitDelay={600}
|
|
40
|
+
maxWidth="110px"
|
|
41
|
+
variant="plain"
|
|
42
|
+
>
|
|
43
|
+
{copied ? 'Successfully copied to clipboard!' : 'Copy to clipboard'}
|
|
44
|
+
</ClipboardCopyButton>
|
|
45
|
+
</CodeBlockAction>
|
|
46
|
+
<CodeBlockAction>
|
|
47
|
+
<Button variant="plain" aria-label="Play icon">
|
|
48
|
+
<PlayIcon />
|
|
49
|
+
</Button>
|
|
50
|
+
</CodeBlockAction>
|
|
51
|
+
</React.Fragment>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<CodeBlock actions={actions}>
|
|
56
|
+
<CodeBlockCode id="code-content">{code}</CodeBlockCode>
|
|
57
|
+
</CodeBlock>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
CodeBlock,
|
|
4
|
+
CodeBlockAction,
|
|
5
|
+
CodeBlockCode,
|
|
6
|
+
ClipboardCopyButton,
|
|
7
|
+
ExpandableSection,
|
|
8
|
+
ExpandableSectionToggle,
|
|
9
|
+
Button
|
|
10
|
+
} from '@patternfly/react-core';
|
|
11
|
+
import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
|
|
12
|
+
|
|
13
|
+
export const ExpandableCodeBlock: React.FunctionComponent = () => {
|
|
14
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
15
|
+
const [copied, setCopied] = React.useState(false);
|
|
16
|
+
|
|
17
|
+
const onToggle = isExpanded => {
|
|
18
|
+
setIsExpanded(isExpanded);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const clipboardCopyFunc = (event, text) => {
|
|
22
|
+
const clipboard = event.currentTarget.parentElement;
|
|
23
|
+
const el = document.createElement('textarea');
|
|
24
|
+
el.value = text.toString();
|
|
25
|
+
clipboard.appendChild(el);
|
|
26
|
+
el.select();
|
|
27
|
+
document.execCommand('copy');
|
|
28
|
+
clipboard.removeChild(el);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const onClick = (event, text) => {
|
|
32
|
+
clipboardCopyFunc(event, text);
|
|
33
|
+
setCopied(true);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const copyBlock = `apiVersion: helm.openshift.io/v1beta1/
|
|
37
|
+
kind: HelmChartRepository
|
|
38
|
+
metadata:
|
|
39
|
+
name: azure-sample-repo
|
|
40
|
+
spec:
|
|
41
|
+
connectionConfig:
|
|
42
|
+
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs`;
|
|
43
|
+
|
|
44
|
+
const code = `apiVersion: helm.openshift.io/v1beta1/
|
|
45
|
+
kind: HelmChartRepository
|
|
46
|
+
metadata:
|
|
47
|
+
name: azure-sample-repo`;
|
|
48
|
+
const expandedCode = `spec:
|
|
49
|
+
connectionConfig:
|
|
50
|
+
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs`;
|
|
51
|
+
|
|
52
|
+
const actions = (
|
|
53
|
+
<React.Fragment>
|
|
54
|
+
<CodeBlockAction>
|
|
55
|
+
<ClipboardCopyButton
|
|
56
|
+
id="copy-button"
|
|
57
|
+
textId="code-content"
|
|
58
|
+
aria-label="Copy to clipboard"
|
|
59
|
+
onClick={e => onClick(e, copyBlock)}
|
|
60
|
+
exitDelay={600}
|
|
61
|
+
maxWidth="110px"
|
|
62
|
+
variant="plain"
|
|
63
|
+
>
|
|
64
|
+
{copied ? 'Successfully copied to clipboard!' : 'Copy to clipboard'}
|
|
65
|
+
</ClipboardCopyButton>
|
|
66
|
+
</CodeBlockAction>
|
|
67
|
+
<CodeBlockAction>
|
|
68
|
+
<Button variant="plain" aria-label="Play icon">
|
|
69
|
+
<PlayIcon />
|
|
70
|
+
</Button>
|
|
71
|
+
</CodeBlockAction>
|
|
72
|
+
</React.Fragment>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<CodeBlock actions={actions}>
|
|
77
|
+
<CodeBlockCode>
|
|
78
|
+
{code}
|
|
79
|
+
<ExpandableSection isExpanded={isExpanded} isDetached contentId="code-block-expand">
|
|
80
|
+
{expandedCode}
|
|
81
|
+
</ExpandableSection>
|
|
82
|
+
</CodeBlockCode>
|
|
83
|
+
<ExpandableSectionToggle isExpanded={isExpanded} onToggle={onToggle} contentId="code-block-expand" direction="up">
|
|
84
|
+
{isExpanded ? 'Show Less' : 'Show More'}
|
|
85
|
+
</ExpandableSectionToggle>
|
|
86
|
+
</CodeBlock>
|
|
87
|
+
);
|
|
88
|
+
};
|