diff --git a/.eleventy.js b/.eleventy.js index 6778eb20a2..d07fe733e6 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -105,6 +105,7 @@ module.exports = function (eleventyConfig) { opened: false, background: undefined, themable: true, + hasPadding: true, heighlight: undefined, heighlightCssComponent: undefined, } @@ -125,6 +126,7 @@ module.exports = function (eleventyConfig) { output += ` background="${finalConfig.background}"` } output += `${finalConfig.themable ? ' themable' : ''}` + output += `${finalConfig.hasPadding ? ' has-padding' : ''}` output += '>\n' output += `
\n\n` output += `\`\`\`${finalConfig.lang}${ diff --git a/src/docs/components/docs-example/docs-example.css b/src/docs/components/docs-example/docs-example.css index 442316595a..f268691a93 100644 --- a/src/docs/components/docs-example/docs-example.css +++ b/src/docs/components/docs-example/docs-example.css @@ -91,7 +91,6 @@ flex: 1 0; align-items: center; justify-content: flex-end; - /*margin: -0.5rem 0;*/ > :not(:first-child) { margin-left: var(--ld-sp-12); @@ -102,15 +101,23 @@ .docs-example__show { background-color: var(--ld-col-neutral-010); color: var(--ld-col-neutral-900); - border: var(--ld-sp-1) solid var(--ld-col-neutral-100); border-bottom-width: 0; border-top-left-radius: var(--ld-br-l); border-top-right-radius: var(--ld-br-l); - padding: 0 var(--ld-sp-8) var(--ld-sp-24); overflow: hidden; - @media (max-width: 48rem) { - padding: 0 0 var(--ld-sp-24); + .docs-example--has-padding & { + border: var(--ld-sp-1) solid var(--ld-col-neutral-100); + padding: 0 var(--ld-sp-8) var(--ld-sp-24); + + @media (max-width: 48rem) { + padding: 0 0 var(--ld-sp-24); + } + + > div > * { + margin: var(--ld-sp-24) var(--ld-sp-24) 0; + max-width: calc(100% - 2 * var(--ld-sp-24)); + } } > div { @@ -119,11 +126,6 @@ align-items: flex-start; justify-content: space-evenly; width: 100%; - - > * { - margin: var(--ld-sp-24) var(--ld-sp-24) 0; - max-width: calc(100% - 2 * var(--ld-sp-24)); - } } } .docs-example__show--stacked { diff --git a/src/docs/components/docs-example/docs-example.tsx b/src/docs/components/docs-example/docs-example.tsx index b3f98e42c9..2d976a0000 100644 --- a/src/docs/components/docs-example/docs-example.tsx +++ b/src/docs/components/docs-example/docs-example.tsx @@ -1,5 +1,6 @@ import '../../../components' // type definitions for type checking and intelliSense import { Component, h, Host, Prop, Listen, State } from '@stencil/core' +import { getClassNames } from '../../../liquid/utils/getClassNames' /** @internal **/ @Component({ @@ -26,6 +27,9 @@ export class DocsExample { /** Enables theme switch. */ @Prop() themable = false + /** Puts some space between content and container. */ + @Prop() hasPadding = false + /** Current theme. */ @State() currentTheme = 'ocean' @@ -51,15 +55,14 @@ export class DocsExample { } render() { - let cl = 'docs-example' - if (this.isCodeVisible) { - cl += ' docs-example--code-visible' - } - if (this.isWebComponent) { - cl += ' docs-example--web-component' - } else { - cl += ' docs-example--css-component' - } + const cl = [ + 'docs-example', + this.isCodeVisible && 'docs-example--code-visible', + this.hasPadding && 'docs-example--has-padding', + this.isWebComponent + ? 'docs-example--web-component' + : ' docs-example--css-component', + ] let clShow = 'docs-example__show' if (this.themable && this.currentTheme) { @@ -69,7 +72,7 @@ export class DocsExample { if (this.background) clShow += ` docs-example__show--${this.background}` return ( - +
diff --git a/src/docs/components/docs-nav/docs-nav.tsx b/src/docs/components/docs-nav/docs-nav.tsx index b4912dd418..8567f980d4 100644 --- a/src/docs/components/docs-nav/docs-nav.tsx +++ b/src/docs/components/docs-nav/docs-nav.tsx @@ -44,6 +44,17 @@ export class DocsNav { } } + componentWillLoad() { + // Make sure the sidenav-open hash is removed on page reload + // when the sidenav is open. + if (location.hash === '#sidenav-open') { + location.hash = '' + setTimeout(() => { + history.replaceState({}, '', window.location.pathname) + }) + } + } + componentDidLoad() { eventBus.on(NavEventType.open, this.onNavOpen.bind(this)) eventBus.on(NavEventType.close, this.onNavClose.bind(this)) diff --git a/src/liquid/components/ld-bg-cells/readme.md b/src/liquid/components/ld-bg-cells/readme.md index 28e215acfa..f0bfc98929 100644 --- a/src/liquid/components/ld-bg-cells/readme.md +++ b/src/liquid/components/ld-bg-cells/readme.md @@ -18,7 +18,7 @@ A background pattern with the Merck cells as additional visual element. ## Default -{% example %} +{% example '{ "hasPadding": false }' %} {% endexample %} - +## Cell types - +{% example '{ "hasPadding": false }' %} + + +{% endexample %} -## Cell types +### f -{% example %} - - type: bioreliance - - - type: f - - - type: hexagon - - - type: millipore - - - type: qa-x2f-qc - - - type: safc - - - type: sigma-aldrich - - - type: t - - - type: tile - +{% example '{ "hasPadding": false }' %} + +{% endexample %} - +{% example '{ "hasPadding": false }' %} + {% endexample %} - - - +### qa -## Custom position, size and colors +{% example '{ "hasPadding": false }' %} + +{% endexample %} -{% example %} - +### safc - +### sigma + +{% example '{ "hasPadding": false }' %} + +{% endexample %} + +### t + +{% example '{ "hasPadding": false }' %} + +{% endexample %} + +### tile + +{% example '{ "hasPadding": false }' %} + {% endexample %} - +## Custom position, size and colors - + +{% endexample %} ## CSS Variables