diff --git a/ui/app/helpers/x-icon.js b/ui/app/helpers/x-icon.js new file mode 100644 index 000000000..d3c670e54 --- /dev/null +++ b/ui/app/helpers/x-icon.js @@ -0,0 +1,21 @@ +import Ember from 'ember'; +import { inlineSvg } from 'ember-inline-svg/helpers/inline-svg'; + +// Generated at compile-time by ember-inline-svg +import SVGs from '../svgs'; + +/** + * Icon Helper + * + * Usage: {{x-icon name}} + * + * Renders an inline svg element by looking it up at `/public/images/icons/${name}.svg` + */ +export function xIcon(params, options) { + const name = params[0]; + const classes = [options.class, 'icon', `icon-is-${name}`].compact().join(' '); + + return inlineSvg(SVGs, name, { class: classes }); +} + +export default Ember.Helper.helper(xIcon); diff --git a/ui/app/styles/core/icon.scss b/ui/app/styles/core/icon.scss new file mode 100644 index 000000000..d100678c3 --- /dev/null +++ b/ui/app/styles/core/icon.scss @@ -0,0 +1,37 @@ +$icon-dimensions: 1.25rem; +$icon-dimensions-small: 1rem; +$icon-dimensions-medium: 1.5rem; +$icon-dimensions-large: 2rem; + +.icon { + align-items: center; + display: inline-flex; + justify-content: center; + vertical-align: text-top; + height: $icon-dimensions; + width: $icon-dimensions; + fill: lighten($text, 25%); + + &.is-small { + height: $icon-dimensions-small; + width: $icon-dimensions-small; + } + + &.is-medium { + height: $icon-dimensions-medium; + width: $icon-dimensions-medium; + } + + &.is-large { + height: $icon-dimensions-large; + width: $icon-dimensions-large; + } + + @each $name, $pair in $colors { + $color: nth($pair, 1); + + &.is-#{$name} { + fill: $color; + } + } +} diff --git a/ui/ember-cli-build.js b/ui/ember-cli-build.js index 0956228ee..7535505a0 100644 --- a/ui/ember-cli-build.js +++ b/ui/ember-cli-build.js @@ -9,6 +9,9 @@ module.exports = function(defaults) { addons: { blacklist: isProd ? ['ember-freestyle'] : [], }, + svg: { + paths: ['public/images/icons'], + }, }); // Use `app.import` to add additional libraries to the generated diff --git a/ui/public/images/icons/warning.svg b/ui/public/images/icons/warning.svg new file mode 100644 index 000000000..e3594a88d --- /dev/null +++ b/ui/public/images/icons/warning.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file