Skip to content

Commit

Permalink
feat(components): remove IBM Helvetica Neue usage (#4752)
Browse files Browse the repository at this point in the history
  • Loading branch information
emyarod authored and joshblack committed Nov 22, 2019
1 parent 6fa0afd commit b58c39d
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 114 deletions.
4 changes: 0 additions & 4 deletions packages/components/demo/scss/_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ td {
@include type-style('productive-heading-01');
font-weight: 300;
line-height: 1.25;

&#helvetica-neue-light {
font-weight: 300;
}
}

h2 {
Expand Down
9 changes: 0 additions & 9 deletions packages/components/src/globals/fonts/LICENSE_helvetica.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@ $css--font-face: false;
expect(result.css.toString()).toMatchSnapshot();
});

it('should output helvetica if $css--font-face is true and $css--plex is false', async () => {
const { result } = await render(`
$css--reset: false;
$css--font-face: true;
$css--plex: false;
@import '../css--font-face';
`);

expect(result.css.toString()).toEqual(
expect.stringContaining('@font-face')
);
expect(result.css.toString()).toEqual(
expect.stringContaining(`font-family: 'IBM Helvetica'`)
);
});

describe('experimental', () => {
it('should output @font-face blocks from elements if components-x flag is enabled', async () => {
const { result } = await render(`
Expand Down
89 changes: 4 additions & 85 deletions packages/components/src/globals/scss/_css--font-face.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,98 +5,17 @@
// LICENSE file in the root directory of this source tree.
//

$font-path: 'https://unpkg.com/carbon-components@latest/src/globals/fonts' !default;

@import './vendor/@carbon/elements/scss/import-once/import-once';
@import 'deprecate';
@import 'helper-mixins';
@import './vendor/@carbon/elements/scss/type/font-face/mono';
@import './vendor/@carbon/elements/scss/type/font-face/sans';

/// @deprecated (For v10) Superseded by `@include carbon--font-face-sans()`, `@include carbon--font-face-mono()`, etc.
/// @access private
/// @group global-font-face
@mixin check-default-font-path {
@if (str-index($font-path, 'https://unpkg.com/') == 1) {
@warn 'The default font path (#{$font-path}) should be used only for demonstration/evaluation purposes. For production applications, please host fonts in your own CDN and change `$font-path` accordingly.';
@content;
} @else {
@content;
}
}

/// Helvetica Neue font face declarations
/// @access public
/// @deprecated (For v10) Use `@include carbon--font-face-sans()`, `@include carbon--font-face-mono()`, etc.
/// @group global-font-face
@mixin helvetica-font-face {
// Default font directory, `!default` flag allows user override.
// (font files are configured to be served as static assets from server.js)
@include deprecate(
'Usage of Helvetica font in `carbon-components` has been deprecated.'
) {
@include check-default-font-path {
@font-face {
font-family: 'IBM Helvetica';
font-style: normal;
font-weight: 300;
src: url('#{$font-path}/helvetica-neue-light.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-light.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: italic;
font-weight: 300;
src: url('#{$font-path}/helvetica-neue-light-italic.woff2')
format('woff2'),
url('#{$font-path}/helvetica-neue-light-italic.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: normal;
font-weight: 400;
src: url('#{$font-path}/helvetica-neue-roman.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-roman.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: italic;
font-weight: 400;
src: url('#{$font-path}/helvetica-neue-roman-italic.woff2')
format('woff2'),
url('#{$font-path}/helvetica-neue-roman-italic.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: normal;
font-weight: 700;
src: url('#{$font-path}/helvetica-neue-bold.woff2') format('woff2'),
url('#{$font-path}/helvetica-neue-bold.woff') format('woff');
}

@font-face {
font-family: 'IBM Helvetica';
font-style: italic;
font-weight: 700;
src: url('#{$font-path}/helvetica-neue-bold-italic.woff2')
format('woff2'),
url('#{$font-path}/helvetica-neue-bold-italic.woff') format('woff');
}
}
}
}

@include exports('css--font-face') {
@if not variable-exists('css--font-face') or $css--font-face == true {
@if variable-exists('css--plex') and $css--plex == true {
@include carbon--font-face-mono();
@include carbon--font-face-sans();
} @else {
@include helvetica-font-face;
@include carbon--font-face-mono();
@include carbon--font-face-sans();
@if not variable-exists('css--plex') or $css--plex == false {
@warn 'Usage of Helvetica font in `carbon-components` has been removed. IBM Plex will be emitted instead';
}
}
}

0 comments on commit b58c39d

Please sign in to comment.