diff --git a/demo/scss/_page.scss b/demo/scss/_page.scss index 54801ad61312..3c4de6665625 100644 --- a/demo/scss/_page.scss +++ b/demo/scss/_page.scss @@ -76,7 +76,7 @@ td { } & > *:not(.component-example):not(.component-variation), - & > { + & > { button { border-radius: 0; } diff --git a/gulpfile.js b/gulpfile.js index 01f41ca639fe..c5a8d6f1710c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -254,7 +254,7 @@ gulp.task('sass:source', () => { }); gulp.task('html:source', () => - templates.render({ preview: 'NONE' }).then(renderedItems => { + templates.render().then(renderedItems => { const promises = []; renderedItems.forEach((rendered, item) => { const dirname = path.dirname(path.resolve(__dirname, 'html', item.relViewPath)); diff --git a/server.js b/server.js index 7a792940d6b6..8feb4ea84c56 100644 --- a/server.js +++ b/server.js @@ -95,7 +95,7 @@ app.get('/component/:component', (req, res) => { res.status(404).end(); } else { templates - .render({ defaultPreview: 'preview', concat: true }, name) + .render({ layout: 'preview', concat: true }, name) .then(rendered => { // eslint-disable-next-line eqeqeq if (rendered == null) { @@ -117,7 +117,7 @@ app.get('/code/:component', (req, res) => { res.status(404).end(); } else { templates - .render({ preview: 'NONE' }, name) + .render({}, name) .then(renderedItems => { const o = {}; renderedItems.forEach((rendered, item) => { diff --git a/src/components/code-snippet/_code-snippet.scss b/src/components/code-snippet/_code-snippet.scss index a89a1218f19f..8130b7be51c9 100644 --- a/src/components/code-snippet/_code-snippet.scss +++ b/src/components/code-snippet/_code-snippet.scss @@ -61,12 +61,15 @@ display: flex; align-items: center; height: 130%; - white-space: nowrap; overflow-x: scroll; position: relative; padding-bottom: $spacing-md; } + .#{$prefix}--snippet--single pre { + white-space: nowrap; + } + // Multi Line Snippet .#{$prefix}--snippet--multi { @include bx--snippet; @@ -165,6 +168,44 @@ transform: rotate(180deg); } + // Skeleton + + #{$prefix}--snippet--multi.#{$prefix}--skeleton { + height: rem(98px); + } + + .#{$prefix}--snippet--single.#{$prefix}--skeleton { + height: rem(56px); + } + + .#{$prefix}--snippet.#{$prefix}--skeleton .#{$prefix}--snippet-container { + height: 100%; + } + + .#{$prefix}--snippet.#{$prefix}--skeleton span { + @include skeleton; + width: 100%; + height: 1rem; + display: block; + margin-top: 0.5rem; + + &:first-child { + margin: 0; + } + + &:nth-child(2) { + width: 85%; + } + + &:nth-child(3) { + width: 95%; + } + } + + .#{$prefix}--snippet--single.#{$prefix}--skeleton .#{$prefix}--snippet-container { + padding-bottom: 0; + } + /* Deprecated class names will be removed in v10.x */ diff --git a/src/components/code-snippet/code-snippet.config.js b/src/components/code-snippet/code-snippet.config.js index 5b6a910d1acd..75db9e9c6c6c 100644 --- a/src/components/code-snippet/code-snippet.config.js +++ b/src/components/code-snippet/code-snippet.config.js @@ -4,26 +4,52 @@ module.exports = { variants: [ { name: 'default', - label: 'Code', + label: 'Single Line', notes: ` Code snippets are small blocks of reusable code that can be inserted in a code file. - The Code style is for larger, multi-line code snippets. + The Single style is for single-line code snippets. `, context: { - variant: 'code', + variant: 'single', }, }, { - name: 'terminal', - label: 'Terminal', + name: 'multi', + label: 'Multi Line', notes: ` Code snippets are small blocks of reusable code that can be inserted in a code file. - The Terminal style is for single-line . + The Multi-line style is for larger code blocks. `, context: { - variant: 'terminal', + variant: 'multi', + }, + }, + { + name: 'inline', + label: 'Inline', + notes: ` + Code snippets are small blocks of reusable code that can be inserted in a code file. + + The inline style is for code blocks within a block of text on a white background. + `, + context: { + variant: 'inline', + light: 'false', + }, + }, + { + name: 'inline-light', + label: 'Inline Light', + notes: ` + Code snippets are small blocks of reusable code that can be inserted in a code file. + + The inline style is for code blocks within a block of text. + `, + context: { + variant: 'inline', + light: 'true', }, }, ], diff --git a/src/components/code-snippet/code-snippet.hbs b/src/components/code-snippet/code-snippet.hbs index b631d12c8ed1..823a847f6e1a 100644 --- a/src/components/code-snippet/code-snippet.hbs +++ b/src/components/code-snippet/code-snippet.hbs @@ -1,36 +1,54 @@ -
-
-@mixin bx--snippet($type) {
- @if $type == 'terminal' {
- background-color: red;
- } @else if $type == 'code' {
- background-color: blue;
- } @else if $type == 'text' {
- background-color: white;
- }
+{{#is variant "inline"}}
+Here is an example of a text that a user would be reading. In this paragraph would be
+
+that the user could look at and copy in to their code editor.
+{{else}}
+
+
+
- @if $type == 'terminal' {
- background-color: red;
- } @else if $type == 'code' {
- background-color: blue;
- } @else if $type == 'text' {
- background-color: white;
+
+
+ @mixin grid-container {
+ width: 100%;
+ padding-right: padding(mobile);
+ padding-left: padding(mobile);
+
+ @include breakpoint(bp--xs--major) {
+ padding-right: padding(xs);
+ padding-left: padding(xs);
+ }
}
-}
-
-
- {{else}}
- node -v Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, veritatis voluptate id incidunt molestiae officia possimus, quasi itaque alias, architecto hic, dicta fugit? Debitis delectus quidem explicabo vitae fuga laboriosam!
+
+ $z-indexes: (
+ modal : 9000,
+ overlay : 8000,
+ dropdown : 7000,
+ header : 6000,
+ footer : 5000,
+ hidden : - 1,
+ overflowHidden: - 1,
+ floating: 10000
+ );
+
+
+
+
+
+ {{#is variant "multi"}}
+
{{/is}}
-
-
Here is an example of a text that a user would be reading. In this paragraph would be - -that the user could look at and copy in to their code editor.
diff --git a/src/components/code-snippet/inline-code-snippet.html b/src/components/code-snippet/inline-code-snippet.html deleted file mode 100644 index 3f681c6145d4..000000000000 --- a/src/components/code-snippet/inline-code-snippet.html +++ /dev/null @@ -1,7 +0,0 @@ - -Here is an example of a text that a user would be reading. In this paragraph would be - - that the user could look at and copy in to their code editor.
diff --git a/src/components/code-snippet/multi-line-code-snippet.html b/src/components/code-snippet/multi-line-code-snippet.html deleted file mode 100644 index bcd0f0a33dee..000000000000 --- a/src/components/code-snippet/multi-line-code-snippet.html +++ /dev/null @@ -1,40 +0,0 @@ -
-
-@mixin grid-container {
- width: 100%;
- padding-right: padding(mobile);
- padding-left: padding(mobile);
-
- @include breakpoint(bp--xs--major) {
- padding-right: padding(xs);
- padding-left: padding(xs);
- }
-}
-
-$z-indexes: (
- modal : 9000,
- overlay : 8000,
- dropdown : 7000,
- header : 6000,
- footer : 5000,
- hidden : - 1,
- overflowHidden: - 1,
- floating: 10000
-);
-
-
- node -v Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis, veritatis voluptate id incidunt molestiae officia possimus, quasi itaque alias, architecto hic, dicta fugit? Debitis delectus quidem explicabo vitae fuga laboriosam!
-