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 @@ -
-
- {{#is variant "code"}} - -
-@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}}
- - + {{/is}} \ No newline at end of file diff --git a/src/components/code-snippet/code-snippet.js b/src/components/code-snippet/code-snippet.js index 1be63e2ccdbf..c3f02943a593 100644 --- a/src/components/code-snippet/code-snippet.js +++ b/src/components/code-snippet/code-snippet.js @@ -16,7 +16,7 @@ class CodeSnippet extends mixin(createComponent, initComponentBySearch, handles) super(element, options); this._initCodeSnippet(); - this.element.querySelector(this.options.classExpandText).addEventListener('click', evt => this._handleClick(evt)); + this.element.querySelector(this.options.classExpandBtn).addEventListener('click', evt => this._handleClick(evt)); } _handleClick() { @@ -66,7 +66,7 @@ class CodeSnippet extends mixin(createComponent, initComponentBySearch, handles) attribShowLessText: 'data-show-less-text', minHeight: 288, classExpanded: 'bx--snippet--expand', - classExpandBtn: 'bx--snippet-btn--expand', + classExpandBtn: '.bx--snippet-btn--expand', classExpandText: '.bx--snippet-btn--text', classHideExpand: 'bx--snippet-btn--expand--hide', }; diff --git a/src/components/code-snippet/inline-code-snippet-light.html b/src/components/code-snippet/inline-code-snippet-light.html deleted file mode 100644 index 0ee65a2dec6b..000000000000 --- a/src/components/code-snippet/inline-code-snippet-light.html +++ /dev/null @@ -1,6 +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/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
-);       
-      
-
-
- - -
diff --git a/src/components/code-snippet/single-line-code-snippet.html b/src/components/code-snippet/single-line-code-snippet.html deleted file mode 100644 index a58f52427106..000000000000 --- a/src/components/code-snippet/single-line-code-snippet.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
-
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!
-
- -
diff --git a/src/globals/scss/_layout.scss b/src/globals/scss/_layout.scss index 0655f4d8dc6e..93bbb2561736 100644 --- a/src/globals/scss/_layout.scss +++ b/src/globals/scss/_layout.scss @@ -62,12 +62,12 @@ $padding: ( } $z-indexes: ( - modal : 9000, - overlay : 8000, - dropdown : 7000, - header : 6000, - footer : 5000, - hidden : - 1, + modal: 9000, + overlay: 8000, + dropdown: 7000, + header: 6000, + footer: 5000, + hidden: - 1, overflowHidden: - 1, floating: 10000 ); diff --git a/src/globals/scss/_typography.scss b/src/globals/scss/_typography.scss index b8167dad5b50..a85a9c5b5c0d 100644 --- a/src/globals/scss/_typography.scss +++ b/src/globals/scss/_typography.scss @@ -8,18 +8,18 @@ $font-family-helvetica: 'IBM Helvetica', Helvetica Neue, HelveticaNeue, Helvetic $base-font-size: 16px !default; // Default, Use with em() and rem() functions $typescale-map: ( - 'giga' : 4.75rem, - 'mega' : 3.375rem, - 'alpha' : 2.25rem, - 'beta' : 1.75rem, - 'gamma' : 1.25rem, - 'delta' : 1.125rem, - 'epsilon' : 1rem, - 'zeta' : 0.875rem, - 'omega' : 0.75rem, - 'caption' : 0.75rem, - 'legal' : 0.6875rem, - 'p' : 1rem + 'giga': 4.75rem, + 'mega': 3.375rem, + 'alpha': 2.25rem, + 'beta': 1.75rem, + 'gamma': 1.25rem, + 'delta': 1.125rem, + 'epsilon': 1rem, + 'zeta': 0.875rem, + 'omega': 0.75rem, + 'caption': 0.75rem, + 'legal': 0.6875rem, + 'p': 1rem ); @mixin typescale($size) { @@ -72,16 +72,16 @@ $typescale-map: ( } $font-size-map: ( - '76' : 4.75rem, - '54' : 3.375rem, - '36' : 2.25rem, - '28' : 1.75rem, - '20' : 1.25rem, - '18' : 1.125rem, - '16' : 1rem, - '14' : 0.875rem, - '12' : 0.75rem, - '11' : 0.6875rem + '76': 4.75rem, + '54': 3.375rem, + '36': 2.25rem, + '28': 1.75rem, + '20': 1.25rem, + '18': 1.125rem, + '16': 1rem, + '14': 0.875rem, + '12': 0.75rem, + '11': 0.6875rem ); @mixin font-size($size) {