@patternfly/documentation-framework 1.0.0

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +3964 -0
  2. package/README.md +92 -0
  3. package/app.js +118 -0
  4. package/assets/android-chrome-36x36.png +0 -0
  5. package/assets/android-chrome-48x48.png +0 -0
  6. package/assets/android-chrome-96x96.png +0 -0
  7. package/assets/favicon-16x16.png +0 -0
  8. package/assets/favicon-32x32.png +0 -0
  9. package/assets/favicon-48x48.png +0 -0
  10. package/assets/favicon.ico +0 -0
  11. package/assets/manifest.json +29 -0
  12. package/components/autoLinkHeader/autoLinkHeader.css +22 -0
  13. package/components/autoLinkHeader/autoLinkHeader.js +41 -0
  14. package/components/cssVariables/cssSearch.js +32 -0
  15. package/components/cssVariables/cssVariables.css +15 -0
  16. package/components/cssVariables/cssVariables.js +233 -0
  17. package/components/example/example.css +106 -0
  18. package/components/example/example.js +196 -0
  19. package/components/example/exampleToolbar.js +208 -0
  20. package/components/example/missing-thumbnail.jpg +0 -0
  21. package/components/footer/RHLogo.png +0 -0
  22. package/components/footer/footer.css +114 -0
  23. package/components/footer/footer.js +262 -0
  24. package/components/gdprBanner/gdprBanner.css +14 -0
  25. package/components/gdprBanner/gdprBanner.js +31 -0
  26. package/components/index.js +12 -0
  27. package/components/inlineAlert/inlineAlert.js +19 -0
  28. package/components/link/link.js +68 -0
  29. package/components/propsTable/propTypeWithLinks.js +33 -0
  30. package/components/propsTable/propsTable.js +82 -0
  31. package/components/sideNav/sideNav.css +17 -0
  32. package/components/sideNav/sideNav.js +95 -0
  33. package/components/tableOfContents/tableOfContents.css +77 -0
  34. package/components/tableOfContents/tableOfContents.js +89 -0
  35. package/components/topNav/topNav.css +30 -0
  36. package/components/topNav/topNav.js +24 -0
  37. package/global.css +7 -0
  38. package/helpers/asyncComponentFactory.js +41 -0
  39. package/helpers/capitalize.js +7 -0
  40. package/helpers/codeTitleTransformer.js +40 -0
  41. package/helpers/codesandbox.js +204 -0
  42. package/helpers/copy.js +19 -0
  43. package/helpers/createHandlebars.js +26 -0
  44. package/helpers/d3-timer.js +7 -0
  45. package/helpers/extractExampleHelpers.js +24 -0
  46. package/helpers/fonts.js +164 -0
  47. package/helpers/getId.js +6 -0
  48. package/helpers/getTitle.js +5 -0
  49. package/helpers/index.js +9 -0
  50. package/helpers/liveCodeTypes.js +4 -0
  51. package/helpers/slugger.js +35 -0
  52. package/helpers/trackEvent.js +17 -0
  53. package/helpers/xterm-addon-fit.js +3 -0
  54. package/helpers/xterm.js +8 -0
  55. package/images/patternfly-logo.svg +14 -0
  56. package/images/patternfly-orb.svg +28 -0
  57. package/layouts/index.js +1 -0
  58. package/layouts/logo.svg +33 -0
  59. package/layouts/sideNavLayout/sideNavLayout.css +104 -0
  60. package/layouts/sideNavLayout/sideNavLayout.js +237 -0
  61. package/package.json +87 -0
  62. package/pages/404/404.css +16 -0
  63. package/pages/404/404.svg +26 -0
  64. package/pages/404/chart.svg +24 -0
  65. package/pages/404/components.svg +1 -0
  66. package/pages/404/guidelines.svg +1 -0
  67. package/pages/404/index.js +136 -0
  68. package/pages/404/patternfly-flat.svg +1 -0
  69. package/pages/global-css-variables.md +108 -0
  70. package/pages/img/component-variable-mapping.png +0 -0
  71. package/pages/red-hat-font.md +40 -0
  72. package/routes-client.js +1 -0
  73. package/routes-generated.js +1 -0
  74. package/routes.js +155 -0
  75. package/scripts/cli/build.js +95 -0
  76. package/scripts/cli/buildClient.js +23 -0
  77. package/scripts/cli/buildServer.js +24 -0
  78. package/scripts/cli/cli.js +63 -0
  79. package/scripts/cli/generate.js +23 -0
  80. package/scripts/cli/helpers.js +9 -0
  81. package/scripts/cli/init.js +68 -0
  82. package/scripts/cli/serve.js +13 -0
  83. package/scripts/cli/start.js +32 -0
  84. package/scripts/md/anchor-header.js +69 -0
  85. package/scripts/md/auto-link-url.js +33 -0
  86. package/scripts/md/example-captions.js +67 -0
  87. package/scripts/md/jsxAttributes.js +20 -0
  88. package/scripts/md/mdx-ast-to-mdx-hast.js +210 -0
  89. package/scripts/md/mdx-hast-to-jsx.js +233 -0
  90. package/scripts/md/parseMD.js +308 -0
  91. package/scripts/md/remove-comments.js +21 -0
  92. package/scripts/md/styled-tags.js +87 -0
  93. package/scripts/md/typecheck.js +133 -0
  94. package/scripts/tsDocgen.js +155 -0
  95. package/scripts/webpack/getHtmlWebpackPlugins.js +78 -0
  96. package/scripts/webpack/prerender.js +59 -0
  97. package/scripts/webpack/webpack.base.config.js +159 -0
  98. package/scripts/webpack/webpack.client.config.js +146 -0
  99. package/scripts/webpack/webpack.server.config.js +55 -0
  100. package/scripts/writeScreenshots.js +66 -0
  101. package/templates/design-guidelines.js +13 -0
  102. package/templates/html.ejs +52 -0
  103. package/templates/mdx.css +308 -0
  104. package/templates/mdx.js +185 -0
  105. package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +25 -0
  106. package/templates/patternfly-docs/content/extensions/extension/design-guidelines/img/card-elements.png +0 -0
  107. package/templates/patternfly-docs/content/extensions/extension/examples/Basic.jsx +4 -0
  108. package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +25 -0
  109. package/templates/patternfly-docs/pages/index.js +27 -0
  110. package/templates/patternfly-docs/patternfly-docs.config.js +6 -0
  111. package/templates/patternfly-docs/patternfly-docs.css.js +8 -0
  112. package/templates/patternfly-docs/patternfly-docs.routes.js +12 -0
  113. package/templates/patternfly-docs/patternfly-docs.source.js +24 -0
  114. package/templates/sitemap.ejs +10 -0
  115. package/versions.json +870 -0
@@ -0,0 +1,308 @@
1
+ #ws-page-content-router {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+ }
6
+
7
+ .ws-release-notes-toc {
8
+ margin-bottom: var(--pf-global--spacer--lg);
9
+ }
10
+
11
+ .ws-release-notes-toc .pf-c-card {
12
+ height: 100%;
13
+ }
14
+
15
+ .ws-release-notes-toc .pf-c-card__title {
16
+ padding-bottom: var(--pf-global--spacer--xs);
17
+ }
18
+
19
+ .ws-release-notes-toc .pf-c-card__title .pf-c-title {
20
+ display: inline;
21
+ }
22
+
23
+ .ws-release-notes-toc .pf-c-card__title a {
24
+ margin-right: var(--pf-global--spacer--sm);
25
+ }
26
+
27
+ .ws-release-notes-toc .pf-c-card__title .pf-c-badge {
28
+ vertical-align: text-top;
29
+ }
30
+
31
+ .ws-release-notes-toc .pf-c-card__body {
32
+ color: #72767B;
33
+ font-family: RedHatText;
34
+ font-size: var(--pf-global--FontSize--md);
35
+ font-weight: 400;
36
+ line-height: 1.5;
37
+ }
38
+
39
+ .ws-code {
40
+ display: inline-block;
41
+ background-color: var(--pf-global--BackgroundColor--100);
42
+ padding: 1px var(--pf-global--spacer--sm);
43
+ border: var(--pf-global--BorderWidth--sm) solid var(--pf-global--BorderColor--300);
44
+ white-space: pre-wrap;
45
+ font-size: var(--pf-global--FontSize--sm);
46
+ font-family: var(--pf-global--FontFamily--monospace);
47
+ }
48
+
49
+ .ws-p + .ws-code {
50
+ margin-bottom: var(--pf-c-content--MarginBottom);
51
+ }
52
+
53
+ /* Table styles */
54
+ /* Undo patternfly reset to respect MD table styles */
55
+ .ws-table td[align="center"],
56
+ .ws-table th[align="center"] {
57
+ text-align: center;
58
+ }
59
+ .ws-table td[align="left"],
60
+ .ws-table th[align="left"] {
61
+ text-align: left;
62
+ }
63
+ .ws-table td[align="right"],
64
+ .ws-table th[align="right"] {
65
+ text-align: right;
66
+ }
67
+ .ws-content-table > .ws-table {
68
+ table-layout: fixed;
69
+ width: 100%;
70
+ }
71
+ .ws-table td > code,
72
+ .ws-table th > code,
73
+ .ws-table tr > code {
74
+ white-space: normal;
75
+ }
76
+ .ws-table tbody > tr > td {
77
+ vertical-align: top;
78
+ }
79
+
80
+ /*
81
+ * Copied from pf-c-content.
82
+ */
83
+ :root {
84
+ --pf-c-content--MarginBottom: var(--pf-global--spacer--md);
85
+ --pf-c-content--LineHeight: var(--pf-global--LineHeight--md);
86
+ --pf-c-content--FontSize: var(--pf-global--FontSize--md);
87
+ --pf-c-content--FontWeight: var(--pf-global--FontWeight--normal);
88
+ --pf-c-content--Color: var(--pf-global--Color--100);
89
+ --pf-c-content--heading--FontFamily: var(--pf-global--FontFamily--heading--sans-serif);
90
+ --pf-c-content--h1--MarginTop: var(--pf-global--spacer--lg);
91
+ --pf-c-content--h1--MarginBottom: var(--pf-global--spacer--sm);
92
+ --pf-c-content--h1--LineHeight: var(--pf-global--LineHeight--sm);
93
+ --pf-c-content--h1--FontSize: var(--pf-global--FontSize--2xl);
94
+ --pf-c-content--h1--FontWeight: var(--pf-global--FontWeight--normal);
95
+ --pf-c-content--h2--MarginTop: var(--pf-global--spacer--lg);
96
+ --pf-c-content--h2--MarginBottom: var(--pf-global--spacer--sm);
97
+ --pf-c-content--h2--LineHeight: var(--pf-global--LineHeight--sm);
98
+ --pf-c-content--h2--FontSize: var(--pf-global--FontSize--xl);
99
+ --pf-c-content--h2--FontWeight: var(--pf-global--FontWeight--normal);
100
+ --pf-c-content--h3--MarginTop: var(--pf-global--spacer--lg);
101
+ --pf-c-content--h3--MarginBottom: var(--pf-global--spacer--sm);
102
+ --pf-c-content--h3--LineHeight: var(--pf-global--LineHeight--md);
103
+ --pf-c-content--h3--FontSize: var(--pf-global--FontSize--lg);
104
+ --pf-c-content--h3--FontWeight: var(--pf-global--FontWeight--normal);
105
+ --pf-c-content--h4--MarginTop: var(--pf-global--spacer--lg);
106
+ --pf-c-content--h4--MarginBottom: var(--pf-global--spacer--sm);
107
+ --pf-c-content--h4--LineHeight: var(--pf-global--LineHeight--md);
108
+ --pf-c-content--h4--FontSize: var(--pf-global--FontSize--md);
109
+ --pf-c-content--h4--FontWeight: var(--pf-global--FontWeight--semi-bold);
110
+ --pf-c-content--h5--MarginTop: var(--pf-global--spacer--lg);
111
+ --pf-c-content--h5--MarginBottom: var(--pf-global--spacer--sm);
112
+ --pf-c-content--h5--LineHeight: var(--pf-global--LineHeight--md);
113
+ --pf-c-content--h5--FontSize: var(--pf-global--FontSize--md);
114
+ --pf-c-content--h5--FontWeight: var(--pf-global--FontWeight--semi-bold);
115
+ --pf-c-content--h6--MarginTop: var(--pf-global--spacer--lg);
116
+ --pf-c-content--h6--MarginBottom: var(--pf-global--spacer--sm);
117
+ --pf-c-content--h6--LineHeight: var(--pf-global--LineHeight--md);
118
+ --pf-c-content--h6--FontSize: var(--pf-global--FontSize--md);
119
+ --pf-c-content--h6--FontWeight: var(--pf-global--FontWeight--semi-bold);
120
+ --pf-c-content--small--MarginBottom: var(--pf-global--spacer--md);
121
+ --pf-c-content--small--LineHeight: var(--pf-global--LineHeight--md);
122
+ --pf-c-content--small--FontSize: var(--pf-global--FontSize--sm);
123
+ --pf-c-content--small--Color: var(--pf-global--Color--200);
124
+ --pf-c-content--small--FontWeight: var(--pf-global--FontWeight--semi-bold);
125
+ --pf-c-content--a--Color: var(--pf-global--link--Color);
126
+ --pf-c-content--a--TextDecoration: var(--pf-global--link--TextDecoration);
127
+ --pf-c-content--a--hover--Color: var(--pf-global--link--Color--hover);
128
+ --pf-c-content--a--hover--TextDecoration: var(--pf-global--link--TextDecoration--hover);
129
+ --pf-c-content--blockquote--PaddingTop: var(--pf-global--spacer--md);
130
+ --pf-c-content--blockquote--PaddingRight: var(--pf-global--spacer--md);
131
+ --pf-c-content--blockquote--PaddingBottom: var(--pf-global--spacer--md);
132
+ --pf-c-content--blockquote--PaddingLeft: var(--pf-global--spacer--md);
133
+ --pf-c-content--blockquote--FontWeight: var(--pf-global--FontWeight--light);
134
+ --pf-c-content--blockquote--Color: var(--pf-global--Color--200);
135
+ --pf-c-content--blockquote--BorderLeftColor: var(--pf-global--BorderColor--100);
136
+ --pf-c-content--blockquote--BorderLeftWidth: var(--pf-global--BorderWidth--lg);
137
+ --pf-c-content--ol--PaddingLeft: var(--pf-global--spacer--lg);
138
+ --pf-c-content--ol--MarginTop: var(--pf-global--spacer--md);
139
+ --pf-c-content--ol--MarginLeft: var(--pf-global--spacer--lg);
140
+ --pf-c-content--ol--nested--MarginTop: var(--pf-global--spacer--sm);
141
+ --pf-c-content--ol--nested--MarginLeft: var(--pf-global--spacer--sm);
142
+ --pf-c-content--ul--PaddingLeft: var(--pf-global--spacer--lg);
143
+ --pf-c-content--ul--MarginTop: var(--pf-global--spacer--md);
144
+ --pf-c-content--ul--MarginLeft: var(--pf-global--spacer--lg);
145
+ --pf-c-content--ul--nested--MarginTop: var(--pf-global--spacer--sm);
146
+ --pf-c-content--ul--nested--MarginLeft: var(--pf-global--spacer--sm);
147
+ --pf-c-content--ul--ListStyle: var(--pf-global--ListStyle);
148
+ --pf-c-content--li--MarginTop: var(--pf-global--spacer--sm);
149
+ --pf-c-content--dl--ColumnGap: var(--pf-global--spacer--2xl);
150
+ --pf-c-content--dl--RowGap: var(--pf-global--spacer--md);
151
+ --pf-c-content--dt--FontWeight: var(--pf-global--FontWeight--semi-bold);
152
+ --pf-c-content--dt--MarginTop: var(--pf-global--spacer--md);
153
+ --pf-c-content--dt--sm--MarginTop: 0;
154
+ --pf-c-content--hr--Height: var(--pf-global--BorderWidth--sm);
155
+ --pf-c-content--hr--BackgroundColor: var(--pf-global--BorderColor--100);
156
+ font-size: var(--pf-c-content--FontSize);
157
+ line-height: var(--pf-c-content--LineHeight);
158
+ color: var(--pf-c-content--Color); }
159
+ .ws-li + li {
160
+ margin-top: var(--pf-c-content--li--MarginTop); }
161
+ .ws-p:not(:last-child),
162
+ .ws-dl:not(:last-child),
163
+ .ws-ol:not(:last-child),
164
+ .ws-ul:not(:last-child),
165
+ .ws-blockquote:not(:last-child),
166
+ .ws-small:not(:last-child),
167
+ .ws-pre:not(:last-child),
168
+ .ws-hr:not(:last-child),
169
+ .ws-table:not(:last-child),
170
+ .ws-content-table:not(:last-child) {
171
+ margin-bottom: var(--pf-c-content--MarginBottom); }
172
+ .ws-h1,
173
+ .ws-h2,
174
+ .ws-h3,
175
+ .ws-h4,
176
+ .ws-h5,
177
+ .ws-h6 {
178
+ margin: 0;
179
+ font-family: var(--pf-c-content--heading--FontFamily); }
180
+ .ws-ol,
181
+ .ws-ul {
182
+ margin: 0; }
183
+ .ws-h1 {
184
+ margin-bottom: var(--pf-c-content--h1--MarginBottom);
185
+ font-size: var(--pf-c-content--h1--FontSize);
186
+ font-weight: var(--pf-c-content--h1--FontWeight);
187
+ line-height: var(--pf-c-content--h1--LineHeight); }
188
+ .ws-h1:not(:first-child) {
189
+ margin-top: var(--pf-c-content--h1--MarginTop); }
190
+ .ws-h2 {
191
+ margin-bottom: var(--pf-c-content--h2--MarginBottom);
192
+ font-size: var(--pf-c-content--h2--FontSize);
193
+ font-weight: var(--pf-c-content--h2--FontWeight);
194
+ line-height: var(--pf-c-content--h2--LineHeight); }
195
+ .ws-h2:not(:first-child) {
196
+ margin-top: var(--pf-c-content--h2--MarginTop); }
197
+ .ws-h3 {
198
+ margin-bottom: var(--pf-c-content--h3--MarginBottom);
199
+ font-size: var(--pf-c-content--h3--FontSize);
200
+ font-weight: var(--pf-c-content--h3--FontWeight);
201
+ line-height: var(--pf-c-content--h3--LineHeight); }
202
+ .ws-h3:not(:first-child) {
203
+ margin-top: var(--pf-c-content--h3--MarginTop); }
204
+ .ws-h4 {
205
+ margin-bottom: var(--pf-c-content--h4--MarginBottom);
206
+ font-size: var(--pf-c-content--h4--FontSize);
207
+ font-weight: var(--pf-c-content--h4--FontWeight);
208
+ line-height: var(--pf-c-content--h4--LineHeight); }
209
+ .ws-h4:not(:first-child) {
210
+ margin-top: var(--pf-c-content--h4--MarginTop); }
211
+ .ws-h5 {
212
+ margin-bottom: var(--pf-c-content--h5--MarginBottom);
213
+ font-size: var(--pf-c-content--h5--FontSize);
214
+ font-weight: var(--pf-c-content--h5--FontWeight);
215
+ line-height: var(--pf-c-content--h5--LineHeight); }
216
+ .ws-h5:not(:first-child) {
217
+ margin-top: var(--pf-c-content--h5--MarginTop); }
218
+ .ws-h6 {
219
+ margin-bottom: var(--pf-c-content--h6--MarginBottom);
220
+ font-size: var(--pf-c-content--h6--FontSize);
221
+ font-weight: var(--pf-c-content--h6--FontWeight);
222
+ line-height: var(--pf-c-content--h6--LineHeight); }
223
+ .ws-h6:not(:first-child) {
224
+ margin-top: var(--pf-c-content--h6--MarginTop); }
225
+ .ws-small {
226
+ display: block;
227
+ font-size: var(--pf-c-content--small--FontSize);
228
+ line-height: var(--pf-c-content--small--LineHeight);
229
+ color: var(--pf-c-content--small--Color); }
230
+ .ws-small:not(:last-child) {
231
+ margin-bottom: var(--pf-c-content--small--MarginBottom); }
232
+ .ws-blockquote {
233
+ padding: var(--pf-c-content--blockquote--PaddingTop) var(--pf-c-content--blockquote--PaddingRight) var(--pf-c-content--blockquote--PaddingBottom) var(--pf-c-content--blockquote--PaddingLeft);
234
+ font-weight: var(--pf-c-content--blockquote--FontWeight);
235
+ color: var(--pf-c-content--blockquote--Color);
236
+ border-left: var(--pf-c-content--blockquote--BorderLeftWidth) solid var(--pf-c-content--blockquote--BorderLeftColor); }
237
+ .ws-hr {
238
+ height: var(--pf-c-content--hr--Height);
239
+ background-color: var(--pf-c-content--hr--BackgroundColor);
240
+ border: none; }
241
+ .ws-ol {
242
+ padding-left: var(--pf-c-content--ol--PaddingLeft);
243
+ margin-top: var(--pf-c-content--ol--MarginTop);
244
+ margin-left: var(--pf-c-content--ol--MarginLeft); }
245
+ .ws-ol ul {
246
+ --pf-c-content--ul--MarginTop: var(--pf-c-content--ul--nested--MarginTop);
247
+ --pf-c-content--ul--MarginLeft: var(--pf-c-content--ul--nested--MarginLeft); }
248
+ .ws-ol ol {
249
+ --pf-c-content--ol--MarginTop: var(--pf-c-content--ol--nested--MarginTop);
250
+ --pf-c-content--ol--MarginLeft: var(--pf-c-content--ol--nested--MarginLeft); }
251
+ .ws-ul {
252
+ padding-left: var(--pf-c-content--ul--PaddingLeft);
253
+ margin-top: var(--pf-c-content--ul--MarginTop);
254
+ margin-left: var(--pf-c-content--ul--MarginLeft);
255
+ list-style: var(--pf-c-content--ul--ListStyle); }
256
+ .ws-ul ul {
257
+ --pf-c-content--ul--MarginTop: var(--pf-c-content--ul--nested--MarginTop);
258
+ --pf-c-content--ul--MarginLeft: var(--pf-c-content--ul--nested--MarginLeft); }
259
+ .ws-ul ol {
260
+ --pf-c-content--ol--MarginTop: var(--pf-c-content--ol--nested--MarginTop);
261
+ --pf-c-content--ol--MarginLeft: var(--pf-c-content--ol--nested--MarginLeft); }
262
+ .ws-dl {
263
+ display: grid;
264
+ grid-template-columns: 1fr; }
265
+ @media screen and (min-width: 576px) {
266
+ .ws-dl {
267
+ grid-template: auto / auto 1fr;
268
+ grid-column-gap: var(--pf-c-content--dl--ColumnGap);
269
+ grid-row-gap: var(--pf-c-content--dl--RowGap); } }
270
+ .ws-dt {
271
+ font-weight: var(--pf-c-content--dt--FontWeight); }
272
+ .ws-dt:not(:first-child) {
273
+ margin-top: var(--pf-c-content--dt--MarginTop); }
274
+ @media screen and (min-width: 576px) {
275
+ .ws-dt:not(:first-child) {
276
+ --pf-c-content--dt--MarginTop: var(--pf-c-content--dt--sm--MarginTop); } }
277
+ @media screen and (min-width: 576px) {
278
+ .ws-dt {
279
+ grid-column: 1; } }
280
+ @media screen and (min-width: 576px) {
281
+ .ws-dd {
282
+ grid-column: 2; } }
283
+
284
+ @media screen and (max-width: 1450px) {
285
+ .ws-mdx-child-template {
286
+ flex-direction: column;
287
+ }
288
+ }
289
+
290
+ .ws-mdx-content {
291
+ flex-grow: 1;
292
+ min-width: 0;
293
+ }
294
+
295
+ /* Design asked for this. A nice side effect is that the TOC doesn't "jump" between pages */
296
+ .ws-mdx-content-content {
297
+ max-width: 832px;
298
+ }
299
+
300
+ .ws-mdx-content-katacoda {
301
+ flex-grow: 1;
302
+ padding: 0;
303
+ }
304
+
305
+ /* Overlay the footer */
306
+ .ws-back-to-top {
307
+ z-index: 2;
308
+ }
@@ -0,0 +1,185 @@
1
+ import React from 'react';
2
+ import { PageSection, Title, PageSectionVariants, BackToTop } from '@patternfly/react-core';
3
+ import { css } from '@patternfly/react-styles';
4
+ import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
5
+ import { Router, useLocation } from '@reach/router';
6
+ import { CSSVariables, PropsTable, TableOfContents, Link, AutoLinkHeader, InlineAlert } from '../components';
7
+ import { capitalize, getTitle, slugger, trackEvent } from '../helpers';
8
+ import './mdx.css';
9
+
10
+ const MDXChildTemplate = ({
11
+ Component,
12
+ source,
13
+ toc = [],
14
+ index = 0
15
+ }) => {
16
+ const {
17
+ propComponents = [],
18
+ sourceLink,
19
+ cssPrefix = [],
20
+ optIn,
21
+ beta,
22
+ katacodaBroken,
23
+ katacodaLayout
24
+ } = Component.getPageData();
25
+ const cssVarsTitle = cssPrefix.length > 0 && 'CSS variables';
26
+ const propsTitle = propComponents.length > 0 && 'Props';
27
+ if (propsTitle && !toc.find(item => item.text === propsTitle)) {
28
+ toc.push({ text: propsTitle });
29
+ toc.push(propComponents.map(propComponent => ({ text: propComponent.name })));
30
+ }
31
+ if (cssVarsTitle && !toc.find(item => item.text === cssVarsTitle)) {
32
+ toc.push({ text: cssVarsTitle });
33
+ }
34
+ // We don't add `id`s in anchor-header.js for items where id === slugger(text)
35
+ // in order to save ~10KB bandwidth.
36
+ if (toc.length > 1) {
37
+ const ensureID = tocItem => {
38
+ if (Array.isArray(tocItem)) {
39
+ tocItem.forEach(ensureID);
40
+ }
41
+ else if (!tocItem.id) {
42
+ tocItem.id = slugger(tocItem.text)
43
+ }
44
+ }
45
+ ensureID(toc);
46
+ }
47
+ const InlineAlerts = (
48
+ <React.Fragment>
49
+ {optIn && (
50
+ <InlineAlert title="Opt-in feature">
51
+ {optIn}
52
+ </InlineAlert>
53
+ )}
54
+ {beta && (
55
+ <InlineAlert title="Beta feature">
56
+ This Beta component is currently under review and is still open for further evolution. It is available for use in product.
57
+ Beta components are considered for promotion on a quarterly basis. Please join in and give us your feedback or submit any questions on the <a href="https://forum.patternfly.org/">PatternFly forum</a> or via <a href="//slack.patternfly.org/" target="_blank" rel="noopener noreferrer">Slack</a>.
58
+ To learn more go to our <a href="https://github.com/patternfly/patternfly-org/tree/main/beta-component-promotion">Beta components</a> page on GitHub.
59
+ </InlineAlert>
60
+ )}
61
+ {katacodaBroken && (
62
+ <InlineAlert variant="warning" title="Down for maintenance">
63
+ The embedded version of our tutorials are broken, but you can still access our tutorials on <a href="https://www.katacoda.com/patternfly">Katacoda.com <ExternalLinkAltIcon /></a>.
64
+ </InlineAlert>
65
+ )}
66
+ </React.Fragment>
67
+ );
68
+ // Create dynamic component for @reach/router
69
+ const ChildComponent = () => (
70
+ <div className="pf-u-display-flex ws-mdx-child-template">
71
+ {toc.length > 1 && (
72
+ <TableOfContents items={toc} />
73
+ )}
74
+ <div className={katacodaLayout? "ws-mdx-content-katacoda" : "ws-mdx-content"}>
75
+ <div className={katacodaLayout ? "" : "ws-mdx-content-content"}>
76
+ {InlineAlerts}
77
+ <Component />
78
+ {propsTitle && (
79
+ <React.Fragment>
80
+ <AutoLinkHeader size="h2" className="ws-h2" id="props">
81
+ {propsTitle}
82
+ </AutoLinkHeader>
83
+ {propComponents.map(component => (
84
+ <PropsTable
85
+ key={component.name}
86
+ title={component.name}
87
+ rows={component.props}
88
+ allPropComponents={propComponents}
89
+ />
90
+ ))}
91
+ </React.Fragment>
92
+ )}
93
+ {cssVarsTitle && (
94
+ <React.Fragment>
95
+ <AutoLinkHeader size="h2" className="ws-h2" id="css-variables">
96
+ {cssVarsTitle}
97
+ </AutoLinkHeader>
98
+ <CSSVariables prefix={cssPrefix} />
99
+ </React.Fragment>
100
+ )}
101
+ {!katacodaLayout && sourceLink && (
102
+ <React.Fragment>
103
+ <br />
104
+ <a href={sourceLink} target="_blank" onClick={() => trackEvent('view_source_click', 'click_event', source.toUpperCase())}>View source on GitHub</a>
105
+ </React.Fragment>
106
+ )}
107
+ </div>
108
+ </div>
109
+ </div>
110
+ );
111
+ ChildComponent.displayName = `MDXChildTemplate${Component.displayName}`;
112
+ return <ChildComponent key={source} path={source} default={index === 0} />;
113
+ }
114
+
115
+ export const MDXTemplate = ({
116
+ title,
117
+ sources = [],
118
+ path
119
+ }) => {
120
+ const sourceKeys = sources.map(v => v.source);
121
+ const isSinglePage = sourceKeys.length === 1;
122
+ const { pathname } = useLocation();
123
+ const { katacodaLayout } = sources[0].Component.getPageData();
124
+ let activeSource = pathname.replace(/\/$/, '').split('/').pop();
125
+ if (!sourceKeys.includes(activeSource)) {
126
+ activeSource = sourceKeys[0];
127
+ }
128
+
129
+ if (typeof document !== 'undefined') {
130
+ document.title = getTitle(title);
131
+ }
132
+
133
+ return (
134
+ <React.Fragment>
135
+ <PageSection
136
+ className={isSinglePage ? "pf-m-light-100" : ""}
137
+ variant={!isSinglePage ? PageSectionVariants.light : ""}
138
+ >
139
+ {!katacodaLayout && <Title size="4xl" headingLevel="h1" id="ws-page-title">
140
+ {title}
141
+ </Title>}
142
+ </PageSection>
143
+ {!isSinglePage && (
144
+ <PageSection type="tabs">
145
+ <div className="pf-c-tabs pf-m-page-insets pf-m-no-border-bottom">
146
+ <ul className="pf-c-tabs__list">
147
+ {sourceKeys.map((source, index) => (
148
+ <li
149
+ key={source}
150
+ className={css(
151
+ 'pf-c-tabs__item',
152
+ activeSource === source && 'pf-m-current'
153
+ )}
154
+ // Send clicked tab name for analytics
155
+ onClick={() => trackEvent('tab_click', 'click_event', source.toUpperCase())}
156
+ >
157
+ <Link className="pf-c-tabs__link" to={`${path}${index === 0 ? '' : '/' + source}`}>
158
+ {capitalize(source.replace('html', 'HTML').replace(/-/g, ' '))}
159
+ </Link>
160
+ </li>
161
+ ))}
162
+ </ul>
163
+ </div>
164
+ </PageSection>
165
+ )}
166
+ <PageSection id="main-content" isFilled className="pf-m-light-100">
167
+ {isSinglePage && (
168
+ <MDXChildTemplate {...sources[0]} />
169
+ )}
170
+ {!isSinglePage && (
171
+ <Router className="pf-u-h-100" primary={false}>
172
+ {sources
173
+ .map((source, index) => {
174
+ source.index = index;
175
+ return source;
176
+ })
177
+ .map(MDXChildTemplate)
178
+ }
179
+ </Router>
180
+ )}
181
+ </PageSection>
182
+ <BackToTop className="ws-back-to-top" scrollableSelector="#ws-page-main" />
183
+ </React.Fragment>
184
+ );
185
+ }
@@ -0,0 +1,25 @@
1
+ ---
2
+ # Sidenav top-level section
3
+ # should be the same for all markdown files for each extension
4
+ section: extensions
5
+ # Sidenav secondary level section
6
+ # should be the same for all markdown files for each extension
7
+ id: My extension
8
+ # Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
9
+ source: design-guidelines
10
+ ---
11
+
12
+ Design guidelines intro
13
+
14
+ ## Header
15
+
16
+ ### Sub-header
17
+
18
+ Referencing an image:
19
+
20
+ <img src="./img/card-elements.png" alt="Elements of a card" width="370"/>
21
+
22
+ 1. A
23
+ 1. list
24
+ 1. using
25
+ 1. markdown
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { Button } from "@patternfly/react-core";
3
+
4
+ const BasicExample = () => <Button variant="primary">My button</Button>;
@@ -0,0 +1,25 @@
1
+ ---
2
+ # Sidenav top-level section
3
+ # should be the same for all markdown files
4
+ section: extensions
5
+ # Sidenav secondary level section
6
+ # should be the same for all markdown files
7
+ id: My extension
8
+ # Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
9
+ source: react
10
+ # If you use typescript, the name of the interface to display props for
11
+ # These are found through the sourceProps function provdided in patternfly-docs.source.js
12
+ propComponents: ['Button']
13
+ ---
14
+
15
+ import { Button } from "@patternfly/react-core";
16
+
17
+ ## Basic usage
18
+
19
+ ### Example
20
+ ```js file="./Basic.jsx"
21
+ ```
22
+
23
+ ### Fullscreen example
24
+ ```js file="./Basic.jsx" isFullscreen
25
+ ```
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { Title, PageSection } from '@patternfly/react-core';
3
+
4
+ const centerStyle = {
5
+ flexGrow: 1,
6
+ display: 'flex',
7
+ alignItems: 'center',
8
+ justifyContent: 'center'
9
+ };
10
+
11
+ const IndexPage = () => {
12
+ return (
13
+ <PageSection variant="light" style={centerStyle}>
14
+ <div style={{ flex: 'none', textAlign: 'center' }}>
15
+ <Title size="4xl" headingLevel="h1">
16
+ My extension docs
17
+ </Title>
18
+ <Title size="2xl" headingLevel="h2">
19
+ {'Hi people!'}
20
+ </Title>
21
+ <p>Welcome to my extension docs.</p>
22
+ </div>
23
+ </PageSection>
24
+ );
25
+ };
26
+
27
+ export default IndexPage;
@@ -0,0 +1,6 @@
1
+ // This module is shared between NodeJS and babelled ES5
2
+ module.exports = {
3
+ sideNavItems: [{ section: 'extensions' }],
4
+ topNavItems: [],
5
+ port: 8006,
6
+ };
@@ -0,0 +1,8 @@
1
+ // Patternfly
2
+ import '@patternfly/patternfly/patternfly.css';
3
+ // Patternfly utilities
4
+ import '@patternfly/patternfly/patternfly-addons.css';
5
+ // Global theme CSS
6
+ import '@patternfly/documentation-framework/global.css';
7
+
8
+ // Add your extension CSS below
@@ -0,0 +1,12 @@
1
+ // This module is shared between NodeJS and babelled ES5
2
+ const isClient = Boolean(process.env.NODE_ENV);
3
+
4
+ module.exports = {
5
+ '/': {
6
+ SyncComponent: isClient && require('./pages/index').default
7
+ },
8
+ '/404': {
9
+ SyncComponent: isClient && require('@patternfly/documentation-framework/pages/404/index').default,
10
+ title: '404 Error'
11
+ }
12
+ };
@@ -0,0 +1,24 @@
1
+ const path = require('path');
2
+
3
+ module.exports = (sourceMD, sourceProps) => {
4
+ // Parse source content for props so that we can display them
5
+ const propsIgnore = ['**/*.test.tsx', '**/examples/*.tsx'];
6
+ const extensionPath = path.join(__dirname, '../src');
7
+ sourceProps(path.join(extensionPath, '/**/*.tsx'), propsIgnore);
8
+
9
+ // Parse md files
10
+ const contentBase = path.join(__dirname, './content');
11
+ sourceMD(path.join(contentBase, 'extensions/**/*.md'), 'extensions');
12
+
13
+ /**
14
+ If you want to parse content from node_modules instead of providing a relative/absolute path,
15
+ you can do something similar to this:
16
+ const extensionPath = require
17
+ .resolve('@patternfly/react-log-viewer/package.json')
18
+ .replace('package.json', 'src');
19
+ sourceProps(path.join(extensionPath, '/**\/*.tsx'), propsIgnore);
20
+ sourceMD(path.join(extensionPath, '../patternfly-docs/**\/examples/*.md'), 'react');
21
+ sourceMD(path.join(extensionPath, '../patternfly-docs/**\/demos/*.md'), 'react-demos');
22
+ sourceMD(path.join(extensionPath, '../patternfly-docs/**\/design-guidelines/*.md'), 'design-guidelines');
23
+ */
24
+ }
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
+ <% urls.forEach(url => {%>
4
+ <url>
5
+ <loc>https://www.patternfly.org/v4<%=url%></loc>
6
+ <changefreq>daily</changefreq>
7
+ <priority>0.7</priority>
8
+ </url>
9
+ <% }); %>
10
+ </urlset>