Skip to content

Commit

Permalink
fix: use icons without "size" values
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Jan 11, 2021
1 parent 17f0a58 commit 3fc7c91
Show file tree
Hide file tree
Showing 37 changed files with 308 additions and 187 deletions.
6 changes: 1 addition & 5 deletions packages/accordion/src/AccordionItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@ export class AccordionItem extends Focusable {
>
${this.label}
</button>
<sp-icon
id="indicator"
size="xs"
class="spectrum-UIIcon-ChevronRight100"
>
<sp-icon id="indicator" class="spectrum-UIIcon-ChevronRight100">
${Chevron100Icon()}
</sp-icon>
</h3>
Expand Down
1 change: 0 additions & 1 deletion packages/action-button/src/ActionButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export class ActionButton extends SizedMixin(ButtonBase) {
buttonContent.unshift(html`
<sp-icon
id="hold-affordance"
size="none"
class="${holdAffordanceClass[this.size]}"
>
${CornerTriangle300Icon()}
Expand Down
60 changes: 60 additions & 0 deletions packages/action-button/src/action-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,63 @@ governing permissions and limitations under the License.
flex-grow: var(--spectrum-actionbutton-label-flex-grow);
text-align: var(--spectrum-actionbutton-label-text-align);
}

:host([size='s']) {
--spectrum-icon-tshirt-size-height: var(
--spectrum-alias-workflow-icon-size-s
);
--spectrum-icon-tshirt-size-width: var(
--spectrum-alias-workflow-icon-size-s
);
--spectrum-ui-icon-tshirt-size-height: var(
--spectrum-alias-ui-icon-cornertriangle-size-75
);
--spectrum-ui-icon-tshirt-size-width: var(
--spectrum-alias-ui-icon-cornertriangle-size-75
);
}

:host([size='m']) {
--spectrum-icon-tshirt-size-height: var(
--spectrum-alias-workflow-icon-size-m
);
--spectrum-icon-tshirt-size-width: var(
--spectrum-alias-workflow-icon-size-m
);
--spectrum-ui-icon-tshirt-size-height: var(
--spectrum-alias-ui-icon-cornertriangle-size-100
);
--spectrum-ui-icon-tshirt-size-width: var(
--spectrum-alias-ui-icon-cornertriangle-size-100
);
}

:host([size='l']) {
--spectrum-icon-tshirt-size-height: var(
--spectrum-alias-workflow-icon-size-l
);
--spectrum-icon-tshirt-size-width: var(
--spectrum-alias-workflow-icon-size-l
);
--spectrum-ui-icon-tshirt-size-height: var(
--spectrum-alias-ui-icon-cornertriangle-size-200
);
--spectrum-ui-icon-tshirt-size-width: var(
--spectrum-alias-ui-icon-cornertriangle-size-200
);
}

:host([size='xl']) {
--spectrum-icon-tshirt-size-height: var(
--spectrum-alias-workflow-icon-size-xl
);
--spectrum-icon-tshirt-size-width: var(
--spectrum-alias-workflow-icon-size-xl
);
--spectrum-ui-icon-tshirt-size-height: var(
--spectrum-alias-ui-icon-cornertriangle-size-300
);
--spectrum-ui-icon-tshirt-size-width: var(
--spectrum-alias-ui-icon-cornertriangle-size-300
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function renderButton(properties: Properties): TemplateResult {

function renderButtonsSelected(properties: Properties): TemplateResult {
const icon = html`
<sp-icon slot="icon" size=${properties.size || 'm'}>
<sp-icon slot="icon">
${EditIcon({ hidden: true })}
</sp-icon>
`;
Expand Down
14 changes: 14 additions & 0 deletions packages/action-button/stories/action-button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,20 @@ export const iconOnlyButton = (): TemplateResult => {
`;
};

export const iconSizeOverridden = (): TemplateResult => {
return html`
<sp-action-button label="Edit" size="xl">
<sp-icon-edit slot="icon" size="s"></sp-icon-edit>
</sp-action-button>
<h1>For testing purposes only</h1>
<p>
This is a test to ensure that sizing the icon will still work when
it's in the scope of a parent element. You shouldn't normally do
this as it deviates from the Spectrum design specification.
</p>
`;
};

export const holdAffordance = (): TemplateResult => {
return html`
<sp-action-group>
Expand Down
60 changes: 30 additions & 30 deletions packages/action-group/stories/action-group.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ export const iconsOnly = (): TemplateResult => {
return html`
<sp-action-group>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -106,17 +106,17 @@ export const quietIconsOnly = (): TemplateResult => {
return html`
<sp-action-group quiet>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -138,17 +138,17 @@ export const compactIconsOnly = (): TemplateResult => {
return html`
<sp-action-group compact>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -160,17 +160,17 @@ export const compactQuietIconsOnly = (): TemplateResult => {
return html`
<sp-action-group compact quiet>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -192,17 +192,17 @@ export const iconsOnlyVertical = (): TemplateResult => {
return html`
<sp-action-group vertical>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -214,17 +214,17 @@ export const quietIconsOnlyVertical = (): TemplateResult => {
return html`
<sp-action-group vertical quiet>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -246,17 +246,17 @@ export const compactIconsOnlyVertical = (): TemplateResult => {
return html`
<sp-action-group vertical compact>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -268,17 +268,17 @@ export const compactQuietIconsOnlyVertical = (): TemplateResult => {
return html`
<sp-action-group vertical compact quiet>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -300,17 +300,17 @@ export const iconsOnlyJustified = (): TemplateResult => {
return html`
<sp-action-group justified>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand All @@ -322,17 +322,17 @@ export const compactIconsOnlyJustified = (): TemplateResult => {
return html`
<sp-action-group compact justified>
<sp-action-button label="Properties">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${PropertiesIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="Info">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${InfoIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
<sp-action-button label="View All Tags">
<sp-icon slot="icon" size="m">
<sp-icon slot="icon">
${ViewAllTagsIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
Expand Down
2 changes: 1 addition & 1 deletion packages/action-menu/src/ActionMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class ActionMenu extends ObserveSlotText(DropdownBase, 'label') {
return [
html`
<slot name="icon" slot="icon" ?icon-only=${!this.hasLabel}>
<sp-icon size="m" class="icon">
<sp-icon class="icon">
${MoreIcon({ hidden: this.hasLabel })}
</sp-icon>
</slot>
Expand Down
2 changes: 1 addition & 1 deletion packages/action-menu/stories/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ActionMenuMarkup = ({
>
${customIcon
? html`
<sp-icon slot="icon" size="m">${customIcon}</sp-icon>
<sp-icon slot="icon">${customIcon}</sp-icon>
`
: html``}
${visibleLabel
Expand Down
2 changes: 1 addition & 1 deletion packages/action-menu/test/action-menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('Action menu', () => {
const el = await fixture<ActionMenu>(
html`
<sp-action-menu label="More Actions">
<sp-icon slot="icon" size="s">
<sp-icon slot="icon">
${SettingsIcon()}
</sp-icon>
<sp-menu>
Expand Down
4 changes: 2 additions & 2 deletions packages/actionbar/stories/actionbar.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export const Default = (): TemplateResult => {
<sp-checkbox indeterminate>228 Selected</sp-checkbox>
<sp-action-group quiet>
<sp-action-button>
<sp-icon size="m" slot="icon">
<sp-icon slot="icon">
${EditIcon()}
</sp-icon>
</sp-action-button>
<sp-action-button>
<sp-icon size="m" slot="icon">
<sp-icon slot="icon">
${MoreIcon()}
</sp-icon>
</sp-action-button>
Expand Down
6 changes: 1 addition & 5 deletions packages/button/src/ClearButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ export class ClearButton extends ButtonBase {
protected get buttonContent(): TemplateResult[] {
return [
html`
<sp-icon
slot="icon"
class="icon spectrum-UIIcon-Cross75"
size="none"
>
<sp-icon slot="icon" class="icon spectrum-UIIcon-Cross75">
${Cross75Icon()}
</sp-icon>
`,
Expand Down
Loading

0 comments on commit 3fc7c91

Please sign in to comment.