Skip to content

Commit

Permalink
feat: split icons into their own export
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Apr 7, 2021
1 parent d14d030 commit 98dac4c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/bundle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ While this bundle directly re-exports the majority of functionality as they woul

#### UI

`@spectrum-web-components/icons-ui` is renamed to `UIIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle` like the following:
`@spectrum-web-components/icons-ui` is renamed to `UIIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle/icons.js` like the following:

```
import { UIIcons } from '@spectrum-web-components/bundle';
import { UIIcons } from '@spectrum-web-components/bundle/icons.js';
console.log(UIIcons.AsteriskIcon());
Expand All @@ -43,10 +43,10 @@ TemplateResult {strings: Array[1], values: Array[0], type: "html", processor: De

#### Workflow

`@spectrum-web-components/icons-workflow` is namespaced to `WorkflowIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle` like the following:
`@spectrum-web-components/icons-workflow` is namespaced to `WorkflowIcons` when leveraging the bundle. This means that you can use workflow icons in your demonstration code by importing them from `@spectrum-web-components/bundle/icons.js` like the following:

```
import { IconsWorkflow } from '@spectrum-web-components/bundle';
import { IconsWorkflow } from '@spectrum-web-components/bundle/icons.js';
console.log(IconsWorkflow.CircleIcon());
Expand Down
4 changes: 3 additions & 1 deletion packages/bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"./src/*": "./src/*",
"./package.json": "./package.json",
"./elements": "./elements.js",
"./elements.js": "./elements.js"
"./elements.js": "./elements.js",
"./icons": "./src/icons.js",
"./icons.js": "./src/icons.js"
},
"files": [
"custom-elements.json",
Expand Down
16 changes: 16 additions & 0 deletions packages/bundle/src/icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

import * as UIIcons from '@spectrum-web-components/icons-ui';
export { UIIcons };
import * as WorkflowIcons from '@spectrum-web-components/icons-workflow';
export { WorkflowIcons };
4 changes: 0 additions & 4 deletions packages/bundle/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ export * from '@spectrum-web-components/field-group';
export * from '@spectrum-web-components/field-label';
export * from '@spectrum-web-components/icon';
export * from '@spectrum-web-components/icons';
import * as UIIcons from '@spectrum-web-components/icons-ui';
export { UIIcons };
import * as WorkflowIcons from '@spectrum-web-components/icons-workflow';
export { WorkflowIcons };
export * from '@spectrum-web-components/illustrated-message';
export * from '@spectrum-web-components/link';
export * from '@spectrum-web-components/menu';
Expand Down

0 comments on commit 98dac4c

Please sign in to comment.