Skip to content

Commit

Permalink
Move internal icons to external package
Browse files Browse the repository at this point in the history
  • Loading branch information
amrocha committed Dec 12, 2018
1 parent 123a54e commit 0d37ee1
Show file tree
Hide file tree
Showing 58 changed files with 76 additions and 112 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
"@shopify/app-bridge": "^0.7.3",
"@shopify/images": "^1.1.0",
"@shopify/javascript-utilities": "^2.2.1",
"@shopify/polaris-icons": "^1.0.0-beta.4",
"@shopify/polaris-tokens": "^2.0.0",
"@shopify/react-compose": "^0.1.6",
"@shopify/react-html": "^3.0.3",
Expand Down
15 changes: 12 additions & 3 deletions playground/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const postcssShopify = require('postcss-shopify');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;

const ICON_PATH_REGEX = /icons\//;
const INTERNAL_ICON_PATH_REGEX = /icons\//;
const PACKAGE_ICON_PATH_REGEX = /polaris-icons\//;
const IMAGE_PATH_REGEX = /\.(jpe?g|png|gif|svg)$/;

module.exports = (env = {production: false}) => ({
Expand Down Expand Up @@ -117,7 +118,11 @@ module.exports = (env = {production: false}) => ({
},
{
test(resource) {
return ICON_PATH_REGEX.test(resource) && resource.endsWith('.svg');
return (
(INTERNAL_ICON_PATH_REGEX.test(resource) ||
PACKAGE_ICON_PATH_REGEX.test(resource)) &&
resource.endsWith('.svg')
);
},
use: [
{
Expand All @@ -134,7 +139,11 @@ module.exports = (env = {production: false}) => ({
{
test(resource) {
return (
IMAGE_PATH_REGEX.test(resource) && !ICON_PATH_REGEX.test(resource)
IMAGE_PATH_REGEX.test(resource) &&
!(
INTERNAL_ICON_PATH_REGEX.test(resource) ||
PACKAGE_ICON_PATH_REGEX.test(resource)
)
);
},
use: [
Expand Down
6 changes: 3 additions & 3 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ import {
circlePlus,
circlePlusOutline,
conversation,
delete as deleteIcon,
deleteIcon,
disable,
dispute,
duplicate,
embed,
export as exportIcon,
exportIcon,
external,
help,
home,
horizontalDots,
import as importIcon,
importIcon,
logOut,
notes,
notification,
Expand Down
1 change: 0 additions & 1 deletion src/icons/add.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/alert.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/arrow-down.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/arrow-left.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/arrow-right.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/arrow-up-down.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/arrow-up.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/calendar.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/cancel-small.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/cancel.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/caret-down.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/caret-up.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/checkmark.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/chevron-down.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/chevron-left.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/chevron-right.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/chevron-up.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/circle-cancel.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/circle-chevron-down.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/circle-chevron-left.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/circle-chevron-right.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/circle-chevron-up.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/circle-information.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/circle-plus-outline.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/circle-plus.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/icons/conversation.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/delete.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/disable.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/dispute.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/duplicate.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/ellipsis.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/embed.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/export.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/external.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/help.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/home.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/horizontal-dots.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/import.svg
Diff not rendered.
108 changes: 55 additions & 53 deletions src/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
export {default as add} from './add.svg';
export {default as alert} from './alert.svg';
export {default as arrowDown} from './arrow-down.svg';
export {default as arrowLeft} from './arrow-left.svg';
export {default as arrowRight} from './arrow-right.svg';
export {default as arrowUp} from './arrow-up.svg';
export {default as arrowUpDown} from './arrow-up-down.svg';
export {default as calendar} from './calendar.svg';
export {default as cancel} from './cancel.svg';
export {default as cancelSmall} from './cancel-small.svg';
export {default as caretDown} from './caret-down.svg';
export {default as caretUp} from './caret-up.svg';
export {default as checkmark} from './checkmark.svg';
export {default as chevronDown} from './chevron-down.svg';
export {default as chevronLeft} from './chevron-left.svg';
export {default as chevronRight} from './chevron-right.svg';
export {default as chevronUp} from './chevron-up.svg';
export {default as circleCancel} from './circle-cancel.svg';
export {default as circleChevronDown} from './circle-chevron-down.svg';
export {default as circleChevronLeft} from './circle-chevron-left.svg';
export {default as circleChevronRight} from './circle-chevron-right.svg';
export {default as circleChevronUp} from './circle-chevron-up.svg';
export {default as circleInformation} from './circle-information.svg';
export {default as circlePlus} from './circle-plus.svg';
export {default as circlePlusOutline} from './circle-plus-outline.svg';
export {default as conversation} from './conversation.svg';
export {default as delete} from './delete.svg';
export {default as disable} from './disable.svg';
export {default as dispute} from './dispute.svg';
export {default as duplicate} from './duplicate.svg';
export {default as embed} from './embed.svg';
export {default as ellipsis} from './ellipsis.svg';
export {default as export} from './export.svg';
export {default as external} from './external.svg';
export {default as help} from './help.svg';
export {default as home} from './home.svg';
export {default as horizontalDots} from './horizontal-dots.svg';
export {default as import} from './import.svg';
export {default as logOut} from './log-out.svg';
export {default as menu} from './menu.svg';
export {default as notes} from './notes.svg';
export {default as notification} from './notification.svg';
export {default as onlineStore} from './online-store.svg';
export {default as orders} from './orders.svg';
export {default as print} from './print.svg';
export {default as products} from './products.svg';
export {default as profile} from './profile.svg';
export {default as subtract} from './subtract.svg';
export {default as refresh} from './refresh.svg';
export {default as risk} from './risk.svg';
export {default as save} from './save.svg';
export {default as search} from './search.svg';
export {default as view} from './view.svg';
import POLARIS_ICONS from '@shopify/polaris-icons';

export const add = POLARIS_ICONS.add;
export const alert = POLARIS_ICONS.alert;
export const arrowDown = POLARIS_ICONS.arrowDown;
export const arrowLeft = POLARIS_ICONS.arrowLeft;
export const arrowRight = POLARIS_ICONS.arrowRight;
export const arrowUp = POLARIS_ICONS.arrowUp;
export const arrowUpDown = POLARIS_ICONS.arrowUpDown;
export const calendar = POLARIS_ICONS.calendar;
export const cancel = POLARIS_ICONS.cancel;
export const cancelSmall = POLARIS_ICONS.cancelSmall;
export const caretDown = POLARIS_ICONS.caretDown;
export const caretUp = POLARIS_ICONS.caretUp;
export const checkmark = POLARIS_ICONS.checkmark;
export const chevronDown = POLARIS_ICONS.chevronDown;
export const chevronLeft = POLARIS_ICONS.chevronLeft;
export const chevronRight = POLARIS_ICONS.chevronRight;
export const chevronUp = POLARIS_ICONS.chevronUp;
export const circleCancel = POLARIS_ICONS.circleCancel;
export const circleChevronDown = POLARIS_ICONS.circleChevronDown;
export const circleChevronLeft = POLARIS_ICONS.circleChevronLeft;
export const circleChevronRight = POLARIS_ICONS.circleChevronRight;
export const circleChevronUp = POLARIS_ICONS.circleChevronUp;
export const circleInformation = POLARIS_ICONS.circleInformation;
export const circlePlus = POLARIS_ICONS.circlePlus;
export const circlePlusOutline = POLARIS_ICONS.circlePlusOutline;
export const conversation = POLARIS_ICONS.conversation;
export const deleteIcon = POLARIS_ICONS.deleteIcon;
export const disable = POLARIS_ICONS.disable;
export const dispute = POLARIS_ICONS.dispute;
export const duplicate = POLARIS_ICONS.duplicate;
export const ellipsis = POLARIS_ICONS.ellipsis;
export const embed = POLARIS_ICONS.embed;
export const exportIcon = POLARIS_ICONS.exportIcon;
export const external = POLARIS_ICONS.external;
export const help = POLARIS_ICONS.help;
export const home = POLARIS_ICONS.home;
export const horizontalDots = POLARIS_ICONS.horizontalDots;
export const importIcon = POLARIS_ICONS.importIcon;
export const logOut = POLARIS_ICONS.logOut;
export const menu = POLARIS_ICONS.menu;
export const notes = POLARIS_ICONS.notes;
export const notification = POLARIS_ICONS.notification;
export const onlineStore = POLARIS_ICONS.onlineStore;
export const orders = POLARIS_ICONS.orders;
export const print = POLARIS_ICONS.print;
export const products = POLARIS_ICONS.products;
export const profile = POLARIS_ICONS.profile;
export const subtract = POLARIS_ICONS.subtract;
export const refresh = POLARIS_ICONS.refresh;
export const risk = POLARIS_ICONS.risk;
export const save = POLARIS_ICONS.save;
export const search = POLARIS_ICONS.search;
export const view = POLARIS_ICONS.view;
1 change: 0 additions & 1 deletion src/icons/log-out.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/menu.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/notes.svg
Diff not rendered.
1 change: 0 additions & 1 deletion src/icons/notification.svg
Diff not rendered.
Loading

0 comments on commit 0d37ee1

Please sign in to comment.