diff --git a/docs/_includes/feedback.html b/docs/_includes/feedback.html index 9f5ea44857..ff2ad10e31 100644 --- a/docs/_includes/feedback.html +++ b/docs/_includes/feedback.html @@ -1,28 +1,15 @@ -{% set searchName = doc.tagName if doc.tagName else (title | slug) %} -{% set related = searchName | relatedItems %} -
- {% section %} - {% if related.length %} -

Related elements or patterns

- - {% elseif title === 'Patterns' %} -

Elements

-

To learn how to use our elements in your designs, visit the Elements section.

- {% else %} -

Patterns

-

To learn how to use our patterns in your designs, visit the Patterns section.

- {% endif %} - {% endsection %} +{% set related = (doc.tagName if doc.tagName else (title | slug)) | relatedItems %} - {% section %} -

Feedback

-

- To give feedback about anything on this page, - contact us. -

- {% endsection %} -
+{% feedback %} + {% if related.length %} +

Related elements or patterns

+ + {% else %} +

Other libraries

+

To learn more about our other libraries, visit this page.

+ {% endif %} +{% endfeedback %} diff --git a/docs/_plugins/shortcodes.cjs b/docs/_plugins/shortcodes.cjs index c1ffdb2ecf..4fbcab5b62 100644 --- a/docs/_plugins/shortcodes.cjs +++ b/docs/_plugins/shortcodes.cjs @@ -4,10 +4,11 @@ const RenderInstallation = require('./shortcodes/renderInstallation.cjs'); const ExampleImage = require('./shortcodes/example.cjs'); const Cta = require('./shortcodes/cta.cjs'); const Alert = require('./shortcodes/alert.cjs'); -const Section = require('./shortcodes/section.cjs'); +const { Section } = require('./shortcodes/section.cjs'); const Demo = require('./shortcodes/demo.cjs'); const SpacerTokensTable = require('./shortcodes/spacerTokensTable.cjs'); const TokensTable = require('./shortcodes/tokensTable.cjs'); +const Feedback = require('./shortcodes/feedback.cjs'); const renderCodeDocs = require('./shortcodes/renderCodeDocs.cjs'); /** @typedef {import('@patternfly/pfe-tools/11ty/DocsPage').DocsPage} DocsPage */ @@ -18,17 +19,17 @@ const renderCodeDocs = require('./shortcodes/renderCodeDocs.cjs'); * @property {object} page * @property {object} eleventy */ - module.exports = function(eleventyConfig) { + eleventyConfig.addPlugin(Section); eleventyConfig.addPlugin(RepoStatus); eleventyConfig.addPlugin(Playground); eleventyConfig.addPlugin(RenderInstallation); eleventyConfig.addPlugin(ExampleImage); eleventyConfig.addPlugin(Cta); eleventyConfig.addPlugin(Alert); - eleventyConfig.addPlugin(Section); eleventyConfig.addPlugin(Demo); eleventyConfig.addPlugin(SpacerTokensTable); eleventyConfig.addPlugin(TokensTable); + eleventyConfig.addPlugin(Feedback); eleventyConfig.addPlugin(renderCodeDocs); }; diff --git a/docs/_plugins/shortcodes/feedback.cjs b/docs/_plugins/shortcodes/feedback.cjs new file mode 100644 index 0000000000..63d438d73c --- /dev/null +++ b/docs/_plugins/shortcodes/feedback.cjs @@ -0,0 +1,33 @@ +const { section } = require('./section.cjs'); + +module.exports = function(eleventyConfig) { + eleventyConfig.addPairedShortcode('feedback', + /** + * Demo + * A live component demo + * @param {string} content + * @param {object} options + * @param {string} options.headline (Optional) Text to go in the heading + * @param {string} options.palette Palette to apply, e.g. lightest, light see components/_section.scss + * @param {string} options.headingLevel The heading level, defaults to 3 + */ + function demoShortcode(content) { + return /* html*/` + +
+ ${section.call(this, content)?.trim() || /* html */` +

Other libraries

+

To learn more about our other libraries, visit this page.

+ `} + ${section.call(this, /* html */` +

Feedback

+

+ To give feedback about anything on this page, + contact us. +

+ `)} +
+ +`; + }); +}; diff --git a/docs/_plugins/shortcodes/renderCodeDocs.cjs b/docs/_plugins/shortcodes/renderCodeDocs.cjs index 618ae3e2dc..88c87633bf 100644 --- a/docs/_plugins/shortcodes/renderCodeDocs.cjs +++ b/docs/_plugins/shortcodes/renderCodeDocs.cjs @@ -4,12 +4,12 @@ import('@patternfly/pfe-tools/11ty/DocsPage.js'); module.exports = function(eleventyConfig) { eleventyConfig.addPairedShortcode('renderCodeDocs', function renderCodeDocs(content, kwargs = {}) { - /** - * NB: since the data for this shortcode is no a POJO, - * but a DocsPage instance, 11ty assigns it to this.ctx._ - * @see https://github.com/11ty/eleventy/blob/bf7c0c0cce1b2cb01561f57fdd33db001df4cb7e/src/Plugins/RenderPlugin.js#L89-L93 - * @type {DocsPage} - */ + /** + * NB: since the data for this shortcode is no a POJO, + * but a DocsPage instance, 11ty assigns it to this.ctx._ + * @see https://github.com/11ty/eleventy/blob/bf7c0c0cce1b2cb01561f57fdd33db001df4cb7e/src/Plugins/RenderPlugin.js#L89-L93 + * @type {DocsPage} + */ const docsPage = this.ctx._; const level = kwargs.level ?? 2; @@ -33,4 +33,3 @@ module.exports = function(eleventyConfig) { } ); }; - diff --git a/docs/_plugins/shortcodes/section.cjs b/docs/_plugins/shortcodes/section.cjs index 4327edd63d..9cb6b3f4b5 100644 --- a/docs/_plugins/shortcodes/section.cjs +++ b/docs/_plugins/shortcodes/section.cjs @@ -1,26 +1,24 @@ const { attrMap } = require('./helpers.cjs'); -module.exports = function(eleventyConfig) { - eleventyConfig.addPairedShortcode('section', - /** - * Section macro - * Creates a section of the page with a heading - * - * @param {string} content - * @param {object} options - * @param {string} options.headline Text to go in the heading - * @param {string} options.palette Palette to apply, e.g. lightest, light see components/_section.scss - * @param {string} options.headingLevel The heading level, defaults to 2 - */ - function(content, { - headline = null, - palette = 'default', - headingLevel = '2', - style = null, - class: className = null, - } = {}) { - const classes = `section section--palette-${palette} ${className ?? ''} container`; - return /* html*/` +/** + * Section macro + * Creates a section of the page with a heading + * + * @param {string} content + * @param {object} options + * @param {string} options.headline Text to go in the heading + * @param {string} options.palette Palette to apply, e.g. lightest, light see components/_section.scss + * @param {string} options.headingLevel The heading level, defaults to 2 + */ +function section(content, { + headline = null, + palette = 'default', + headingLevel = '2', + style = null, + class: className = null, +} = {}) { + const classes = `section section--palette-${palette} ${className ?? ''} container`; + return /* html*/`
${!headline ? '' : ` ${Array.from({ length: headingLevel }, () => '#').join('')} ${headline} {.section-title .pfe-jump-links-panel__section} `} @@ -30,5 +28,10 @@ ${content}
`; - }); -}; +} + +function Section(eleventyConfig) { + eleventyConfig.addPairedShortcode('section', section); +} + +module.exports = { Section, section }; diff --git a/docs/about/how-we-build.njk b/docs/about/how-we-build.njk index 18742377d3..213d2fe8e9 100644 --- a/docs/about/how-we-build.njk +++ b/docs/about/how-we-build.njk @@ -154,14 +154,7 @@ tags: {%- endcall %} -
- - {% call about.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} - - {% call about.section("Other resources") -%} -

To learn how to use our design system kit and libraries, visit this page.

- {%- endcall %} - -
+{% feedback %} +

Other resources

+

To learn how to use our design system kit and libraries, visit this page.

+{% endfeedback %} diff --git a/docs/design-code-status.njk b/docs/design-code-status.njk index ae57918e40..6edfe264b3 100644 --- a/docs/design-code-status.njk +++ b/docs/design-code-status.njk @@ -300,14 +300,8 @@ title: Design/code status {%- endcall %} -
+{% feedback %} +

Release notes

+

To see what foundations, tokens, elements, or patterns have been released recently, visit this page.

+{% endfeedback %} - {% call components.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} - - {% call components.section("Release notes") -%} -

To see what foundations or components have been released recently, visit this page.

- {%- endcall %} - -
diff --git a/docs/elements/index.md b/docs/elements/index.md index ed73690cd9..2c40b3e7ca 100644 --- a/docs/elements/index.md +++ b/docs/elements/index.md @@ -61,4 +61,7 @@ summaries: To request a new element or if updates need to be made to an existing element, create a GitHub issue. {% endsection %} -{% include 'feedback.html' %} +{% feedback %} +

Elements

+

To learn how to use our elements in your designs, visit the Elements section.

+{% endfeedback %} diff --git a/docs/foundations/color.njk b/docs/foundations/color.njk index 0badbcc255..c7fada84d8 100644 --- a/docs/foundations/color.njk +++ b/docs/foundations/color.njk @@ -483,14 +483,8 @@ includeComponent: {%- endcall %} -
+{% feedback %} +

Foundations

+

To learn how to use our other foundations in your designs, visit the foundations section.

+{% endfeedback %} - {% call foundations.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} - - {% call foundations.section("Foundations") -%} -

To learn how to use our other foundations in your designs, visit the foundations section.

- {%- endcall %} - -
diff --git a/docs/foundations/grid.njk b/docs/foundations/grid.njk index 7c3ce9552d..c1f58217ff 100644 --- a/docs/foundations/grid.njk +++ b/docs/foundations/grid.njk @@ -179,14 +179,9 @@ tags: {%- endcall %} -
+{% feedback %} +

Foundations

+

To learn how to use our other foundations in your designs, visit the foundations section.

+{% endfeedback %} - {% call foundations.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} - {% call foundations.section("Foundations") -%} -

To learn how to use our other foundations in your designs, visit the foundations section.

- {%- endcall %} - -
diff --git a/docs/foundations/personalization.njk b/docs/foundations/personalization.njk index 8222f6380d..97d8920a41 100644 --- a/docs/foundations/personalization.njk +++ b/docs/foundations/personalization.njk @@ -371,14 +371,7 @@ includeComponent: {%- endcall %} -
- - {% call components.section("Patterns") -%} -

To learn how to use our other patterns in your designs, visit the Patterns section.

- {%- endcall %} - - {% call components.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} - -
+{% feedback %} +

Foundations

+

To learn how to use our other foundations in your designs, visit the foundations section.

+{% endfeedback %} diff --git a/docs/foundations/spacing.njk b/docs/foundations/spacing.njk index d36ba42a0d..a98e2357f2 100644 --- a/docs/foundations/spacing.njk +++ b/docs/foundations/spacing.njk @@ -531,14 +531,8 @@ tags: {%- endcall %} -
+{% feedback %} +

Foundations

+

To learn how to use our other foundations in your designs, visit the foundations section.

+{% endfeedback %} - {% call foundations.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} - - {% call foundations.section("Foundations") -%} -

To learn how to use our other foundations in your designs, visit the foundations section.

- {%- endcall %} - -
diff --git a/docs/foundations/typography.njk b/docs/foundations/typography.njk index af2263dcea..6ccb543f2c 100644 --- a/docs/foundations/typography.njk +++ b/docs/foundations/typography.njk @@ -445,14 +445,7 @@ tags: {%- endcall %} -
- - {% call foundations.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} - - {% call foundations.section("Foundations") -%} -

To learn how to use our other foundations in your designs, visit the foundations section.

- {%- endcall %} - -
+{% feedback %} +

Foundations

+

To learn how to use our other foundations in your designs, visit the foundations section.

+{% endfeedback %} diff --git a/docs/get-started.njk b/docs/get-started.njk index 64019d92e4..f282a0d045 100644 --- a/docs/get-started.njk +++ b/docs/get-started.njk @@ -47,17 +47,9 @@ order: 0 {%- endcall %} - - -
-
- {% call getstarted.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} -
-
- {% call getstarted.section("Explore") -%} -

Our libraries include elements, patterns, icons, and product logos to help you design Red Hat experiences.

- {%- endcall %} -
-
+{% feedback %} +

Explore

+

Our libraries include elements, patterns, + icons, + and product logos to help you design Red Hat experiences.

+{% endfeedback %} diff --git a/docs/get-started/design-system-kit.njk b/docs/get-started/design-system-kit.njk index aed54b1554..6cb5c3012e 100644 --- a/docs/get-started/design-system-kit.njk +++ b/docs/get-started/design-system-kit.njk @@ -204,17 +204,7 @@ includeComponent: {%- endcall %} - - -
-
- {% call getstarted.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} -
-
- {% call getstarted.section("Other libraries") -%} -

To learn more about our other libraries, visit this page.

- {%- endcall %} -
-
+{% feedback %} +

Other libraries

+

To learn more about our other libraries, visit this page.

+{% endfeedback %} diff --git a/docs/get-started/fts-starter-kit.njk b/docs/get-started/fts-starter-kit.njk index 99ace05ed7..3f34bb2f6c 100644 --- a/docs/get-started/fts-starter-kit.njk +++ b/docs/get-started/fts-starter-kit.njk @@ -229,17 +229,8 @@ tags: {%- endcall %} - +{% feedback %} +

Other libraries

+

To learn more about our other libraries, visit this page.

+{% endfeedback %} -
-
- {% call getstarted.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} -
-
- {% call getstarted.section("Other libraries") -%} -

To learn more about our other libraries, visit this page.

- {%- endcall %} -
-
diff --git a/docs/get-started/icon-libraries.njk b/docs/get-started/icon-libraries.njk index 9855f37ecf..14282841cb 100644 --- a/docs/get-started/icon-libraries.njk +++ b/docs/get-started/icon-libraries.njk @@ -137,17 +137,8 @@ tags: {%- endcall %} - +{% feedback %} +

Icons

+

To learn more about how to use icons, visit our brand standards page.

+{% endfeedback %} -
-
- {% call getstarted.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} -
-
- {% call getstarted.section("Icons") -%} -

To learn more about how to use icons, visit our brand standards page.

- {%- endcall %} -
-
diff --git a/docs/get-started/product-logo-library.njk b/docs/get-started/product-logo-library.njk index 0d01f2eae0..7d76acf0cb 100644 --- a/docs/get-started/product-logo-library.njk +++ b/docs/get-started/product-logo-library.njk @@ -122,17 +122,7 @@ tags: {%- endcall %} - - -
-
- {% call getstarted.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} -
-
- {% call getstarted.section("Product logos") -%} -

To learn more about how to use product logos, visit our brand standards page.

- {%- endcall %} -
-
+{% feedback %} +

Product logos

+

To learn more about how to use product logos, visit our brand standards page.

+{% endfeedback %} diff --git a/docs/patterns/index.md b/docs/patterns/index.md index 2af544657a..7547c6a121 100644 --- a/docs/patterns/index.md +++ b/docs/patterns/index.md @@ -48,4 +48,7 @@ create uniform, accessible experiences. To request a new element or if updates need to be made to an existing element, [contact us](mailto:digital-design-system@redhat.com). -{% include 'feedback.html' %} +{% feedback %} +

Patterns

+

To learn how to use our patterns in your designs, visit the Patterns section.

+{% endfeedback %} diff --git a/docs/prerelease-notes.njk b/docs/prerelease-notes.njk index b619920a28..44bbe923dd 100644 --- a/docs/prerelease-notes.njk +++ b/docs/prerelease-notes.njk @@ -421,13 +421,4 @@ title: Beta release notes {%- endcall %} - - -
- {% call components.section("Feedback") -%} -

To give feedback about anything on this page, contact us.

- {%- endcall %} - {% call components.section("Design and code status") -%} -

To check the design and code status of a foundation or component, visit this page.

- {%- endcall %} -
+{% include 'feedback.html' %} diff --git a/docs/release-notes.md b/docs/release-notes.md index 8bb6d38204..0158662660 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -127,4 +127,9 @@ Released April 3, 2023 For release notes on older versions, please [view our release notes on GitHub](https://github.com/RedHat-UX/red-hat-design-system/releases). - + +{% feedback %} +

Design and code status

+

To check the design and code status of a foundation or component, visit this page.

+{% endfeedback %} +