Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete unused icons, update story #96

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/stories.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.sb-all-icons {
margin-top: 24px;
margin-top: 12px;
width: 100%;
display: flex;
flex-wrap: wrap;
Expand Down
104 changes: 2 additions & 102 deletions components/src/stories/Icon.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import registerWidget from '~core/registerWidget';

import * as iconsAnimated from '@cloudblueconnect/material-svg/animated';
import * as iconsBaseline from '@cloudblueconnect/material-svg/baseline';
import * as iconsOutline from '@cloudblueconnect/material-svg/outline';
import * as iconsRound from '@cloudblueconnect/material-svg/round';
import * as iconsSharp from '@cloudblueconnect/material-svg/sharp';
import * as iconsTwotone from '@cloudblueconnect/material-svg/twotone';

registerWidget('ui-icon', Icon);

Expand Down Expand Up @@ -51,7 +47,7 @@ export const Animated = {
Object.keys(iconsAnimated)
.map(
(icon) =>
`<div className="sb-icon-wrapper"><ui-icon className="sb-icon" iconName="${icon}" size="32"/> <span>${icon}</span></div>`,
`<div className="sb-icon-wrapper"><ui-icon className="sb-icon" iconName="${icon}" size="24"/> <span>${icon}</span></div>`,
)
.join('') +
'</div>',
Expand All @@ -75,103 +71,7 @@ export const Baseline = {
Object.keys(iconsBaseline)
.map(
(icon) =>
`<div className="sb-icon-wrapper"><ui-icon className="sb-icon" iconName="${icon}" size="32"/> <span>${icon}</span></div>`,
)
.join('') +
'</div>',
}),
args: {},
argTypes: {
iconName: { control: false },
size: { control: false },
color: { control: false },
},
};

export const Outline = {
name: 'All outline',
render: () => ({
setup() {
return {};
},
template:
'<div className="sb-all-icons">' +
Object.keys(iconsOutline)
.map(
(icon) =>
`<div className="sb-icon-wrapper"><ui-icon className="sb-icon" iconName="${icon}" size="32"/> <span>${icon}</span></div>`,
)
.join('') +
'</div>',
}),
args: {},
argTypes: {
iconName: { control: false },
size: { control: false },
color: { control: false },
},
};

export const Round = {
name: 'All round',
render: () => ({
setup() {
return {};
},
template:
'<div className="sb-all-icons">' +
Object.keys(iconsRound)
.map(
(icon) =>
`<div className="sb-icon-wrapper"><ui-icon className="sb-icon" iconName="${icon}" size="32"/> <span>${icon}</span></div>`,
)
.join('') +
'</div>',
}),
args: {},
argTypes: {
iconName: { control: false },
size: { control: false },
color: { control: false },
},
};

export const Sharp = {
name: 'All sharp',
render: () => ({
setup() {
return {};
},
template:
'<div className="sb-all-icons">' +
Object.keys(iconsSharp)
.map(
(icon) =>
`<div className="sb-icon-wrapper"><ui-icon className="sb-icon" iconName="${icon}" size="32"/> <span>${icon}</span></div>`,
)
.join('') +
'</div>',
}),
args: {},
argTypes: {
iconName: { control: false },
size: { control: false },
color: { control: false },
},
};

export const Twotone = {
name: 'All twotone',
render: () => ({
setup() {
return {};
},
template:
'<div className="sb-all-icons">' +
Object.keys(iconsTwotone)
.map(
(icon) =>
`<div className="sb-icon-wrapper"><ui-icon className="sb-icon" iconName="${icon}" size="32"/> <span>${icon}</span></div>`,
`<div className="sb-icon-wrapper"><ui-icon className="sb-icon" iconName="${icon}" size="24"/> <span>${icon}</span></div>`,
)
.join('') +
'</div>',
Expand Down
9 changes: 7 additions & 2 deletions components/src/widgets/icon/widget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

<script setup>
import { defineOptions, computed } from 'vue';
import * as icons from '@cloudblueconnect/material-svg';
import * as iconsAnimated from '@cloudblueconnect/material-svg/animated';
import * as iconsBaseline from '@cloudblueconnect/material-svg/baseline';
defineOptions({
name: 'Icon',
});
Expand Down Expand Up @@ -40,8 +41,12 @@ const styles = computed(() => {
};
});

const icons = computed(() => {
return { ...iconsBaseline, ...iconsAnimated };
});

const icon = computed(() => {
return icons[props.iconName];
return icons.value[props.iconName];
});
</script>

Expand Down
Loading