From 8fe5c55594aa0afe0c64e90167f0f9e3d27ca322 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Mon, 26 Oct 2020 12:25:34 -0700 Subject: [PATCH] New all-icons helper that's really only meant for development use This returns an array of all icons. As the comment suggests, it's because the SVGs file can't be imported in stories since it is generated as part of the Ember project. --- ui/app/helpers/all-icons.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ui/app/helpers/all-icons.js diff --git a/ui/app/helpers/all-icons.js b/ui/app/helpers/all-icons.js new file mode 100644 index 000000000..57227f773 --- /dev/null +++ b/ui/app/helpers/all-icons.js @@ -0,0 +1,18 @@ +import { helper } from '@ember/component/helper'; + +// Generated at compile-time by ember-inline-svg +import SVGs from '../svgs'; + +/** + * Icons array + * + * Usage: {{#each (all-icons) as |icon|}} + * + * Returns the array of all icon strings available to {{x-icon}}. This is a bit of a hack + * since the above SVGs import isn't available in the Storybook context. + */ +export function allIcons() { + return Object.keys(SVGs); +} + +export default helper(allIcons);