Skip to content

Commit

Permalink
Merge pull request #77 from SAP/bug/72
Browse files Browse the repository at this point in the history
#72 Iconfont problem when using the SCSS source
  • Loading branch information
Saad M authored Feb 15, 2018
2 parents 362da34 + 3640545 commit 5a850d1
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 64 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,16 @@ At the time this version was released, there are no known limitations

# Known Issues

At the time this version was released, there are no known issues.
### Configuring icons path when importing SCSS

If you are importing .scss files in your project, the icons path needs to be configured in your project's .scss file before the Fundamental UI scss import as described below. Please note that the path variable name has to be `$fd-icons-path` in order to override the default value set in `scss/icons/icon.scss`.

```
$fd-icons-path : "../node_modules/fundamental-ui/scss/icons/"; // should be declared before the scss import

@import "../node_modules/fundamental-ui/scss/all.scss";

```
# How to obtain support
Expand All @@ -141,7 +150,7 @@ If you encounter an issue, you can [create a ticket](https://github.com/SAP/fund
# Contributing
Details of where and how to start developing the new component can be found in test/README.MD file.
Details of where and how to start developing the new component can be found in `test/README.MD` file.
New branches should include the type (feature, bug, or hotfix) and the issue number or release number.
```
Expand Down
78 changes: 39 additions & 39 deletions docs/_data/icons.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
- name: add
- name: arrow
- name: backarrow
- name: caution
- name: change
- name: checked
- name: chevron
- name: clone
- name: close
- name: collapse
- name: delete
- name: done
- name: doublechevron
- name: dragdroplist
- name: dragdropobject
- name: edit
- name: expand
- name: feedback
- name: filter
- name: filterremove
- name: grid
- name: help
- name: infoon
- name: link
- name: list
- name: localization
- name: lock
- name: maximize
- name: minimize
- name: more
- name: noimage
- name: options
- name: search
- name: sort
- name: sync
- name: top
- name: visibilityoff
- name: visibilityon
- name: warning
- name: add
- name: arrow
- name: backarrow
- name: caution
- name: change
- name: checked
- name: chevron
- name: clone
- name: close
- name: collapse
- name: delete
- name: done
- name: doublechevron
- name: dragdroplist
- name: dragdropobject
- name: edit
- name: expand
- name: feedback
- name: filter
- name: filterremove
- name: grid
- name: help
- name: infoon
- name: link
- name: list
- name: localization
- name: lock
- name: maximize
- name: minimize
- name: more
- name: noimage
- name: options
- name: search
- name: sort
- name: sync
- name: top
- name: visibilityoff
- name: visibilityon
- name: warning
2 changes: 1 addition & 1 deletion docs/css/fundamental-ui.css

Large diffs are not rendered by default.

22 changes: 14 additions & 8 deletions icons/icons-template.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
@import "../core/mixins";
@import "../core/functions";

$fd-scss-icons-path : ""!default;

@if variable-exists(iconsPath) {
$fd-scss-icons-path : $icons-path ;
}

@font-face {
font-family: "<%= fontName %>";
src: url("<%= fontName %>.woff2") format("woff2"),
url("<%= fontName %>.woff") format("woff");
src: url("#{$fd-scss-icons-path}<%= fontName %>.woff2") format("woff2"),
url("#{$fd-scss-icons-path}<%= fontName %>.woff") format("woff");
font-weight: normal;
font-style: normal;
}
Expand Down Expand Up @@ -37,10 +43,10 @@ $block: ns(<%= className %>);
// }

.#{$block} {
$tn-icon-size: 1.125rem !default; //18px
$tn-icon-size--medium: 1.625rem !default; //26px
$tn-icon-size--large: 2rem !default; //32px
font-size: $tn-icon-size;
$fd-icon-size: 1.125rem !default; //18px
$fd-icon-size--medium: 1.625rem !default; //26px
$fd-icon-size--large: 2rem !default; //32px
font-size: $fd-icon-size;
font-family: "<%= fontName %>";
line-height: 1;
font-style: normal;
Expand All @@ -53,10 +59,10 @@ $block: ns(<%= className %>);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
&--medium {
font-size: $tn-icon-size--medium;
font-size: $fd-icon-size--medium;
}
&--large {
font-size: $tn-icon-size--large;
font-size: $fd-icon-size--large;
}
&::before {
display: inline;
Expand Down
Binary file modified scss/icons/FundamentalIcons.woff
Binary file not shown.
Binary file modified scss/icons/FundamentalIcons.woff2
Binary file not shown.
32 changes: 19 additions & 13 deletions scss/icons/icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
@import "../core/mixins";
@import "../core/functions";

$fd-scss-icons-path : ""!default;

@if variable-exists(fd-icons-path) {
$fd-scss-icons-path : $fd-icons-path ;
}

@font-face {
font-family: "FundamentalIcons";
src: url("FundamentalIcons.woff2") format("woff2"),
url("FundamentalIcons.woff") format("woff");
src: url("#{$fd-scss-icons-path}FundamentalIcons.woff2") format("woff2"),
url("#{$fd-scss-icons-path}FundamentalIcons.woff") format("woff");
font-weight: normal;
font-style: normal;
}

//icon map
$tn-icons: (
$fd-icons: (

add: "\ea01",

Expand Down Expand Up @@ -98,13 +104,13 @@ $block: ns(icon);

//TODO: finish mixin
// @mixin icon($key, $size) {
// @if map-has-key($tn-icons, $size) {
// @if map-has-key($fd-icons, $size) {
// &::before {
// content: map-get($tn-icons, $key);
// content: map-get($fd-icons, $key);
// @content;
// }
// } @else {
// @warn "Unknown `#{$key}` in $tn-icons map";
// @warn "Unknown `#{$key}` in $fd-icons map";
// }
// }

Expand All @@ -113,10 +119,10 @@ $block: ns(icon);
// }

.#{$block} {
$tn-icon-size: 1.125rem !default; //18px
$tn-icon-size--medium: 1.625rem !default; //26px
$tn-icon-size--large: 2rem !default; //32px
font-size: $tn-icon-size;
$fd-icon-size: 1.125rem !default; //18px
$fd-icon-size--medium: 1.625rem !default; //26px
$fd-icon-size--large: 2rem !default; //32px
font-size: $fd-icon-size;
font-family: "FundamentalIcons";
line-height: 1;
font-style: normal;
Expand All @@ -129,17 +135,17 @@ $block: ns(icon);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
&--medium {
font-size: $tn-icon-size--medium;
font-size: $fd-icon-size--medium;
}
&--large {
font-size: $tn-icon-size--large;
font-size: $fd-icon-size--large;
}
&::before {
display: inline;
text-align: center;
}

@each $key, $value in $tn-icons {
@each $key, $value in $fd-icons {
&--#{$key} {
&::before {
content: $value;
Expand Down
2 changes: 1 addition & 1 deletion test/templates/icon/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

}

}
}

0 comments on commit 5a850d1

Please sign in to comment.