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

Remove Salt icon color and style overrides #487

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions .changeset/nervous-cougars-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@jpmorganchase/mosaic-components': patch
'@jpmorganchase/mosaic-theme': patch
---

Removed overrides for Salt icon color and size.
Mosaic Icon component now uses number for size.
2 changes: 1 addition & 1 deletion packages/components/src/AudioPlayer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const AudioPlayer: React.FC<AudioPlayerProps> = ({ src, title, skipDurati
<div>
<a href={src} download target="_blank" rel="noreferrer">
<OrderedButton variant="secondary" className={styles.button}>
<Icon name="download" size="small" />
<Icon name="download" />
</OrderedButton>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/Callout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const Callout: React.FC<CalloutProps> = ({
const titleText = titleProp !== undefined ? titleProp : title;
return (
<div className={classnames(styles.root, styles[`${variant}Border`], className)} {...rest}>
<Icon className={classnames(styles.icon, styles[variant])} size="medium" name={iconName} />
<Icon className={classnames(styles.icon, styles[variant])} size={2} name={iconName} />
<span className={styles.title}>{titleText}</span>
<div className={styles.content}>{children}</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function FilterDropdown({
source={listItems}
triggerComponent={
<span className={styles.triggerRoot}>
<Icon name="filter" size="small" />
<Icon name="filter" />
<DropdownButton
label={labelButton ? labelButton(filters) : defaultButtonLabel(filters)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function FilterSortDropdown({
source={source}
triggerComponent={
<span className={styles.triggerRoot}>
<Icon name="swap" size="small" />
<Icon name="swap" />
<DropdownButton label={labelButton ? labelButton(sort) : sort} />
</span>
}
Expand Down
8 changes: 3 additions & 5 deletions packages/components/src/Icon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React from 'react';
import { icons, IconNames } from '@jpmorganchase/mosaic-theme';

import styles from './styles.css';

export interface IconProps {
/** Additional class name for root class override. */
className?: string;
/** Name of the icon */
name: IconNames;
/** Size of Icon */
size?: 'small' | 'medium' | 'large';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do teams use Icon directly? If so will this cause adoption issues? It it worth supporting both and then mapping to the new values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any uses of it in the main docs repo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be safer to keep this but I don't know if its necessary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep it for now.

size?: number;
}

const deprecatedIcons = {
Expand All @@ -19,7 +17,7 @@ const deprecatedIcons = {
export const Icon: React.FC<React.PropsWithChildren<IconProps>> = ({
className,
name,
size = 'small',
size = 1,
...rest
}) => {
if (name === 'none') {
Expand All @@ -39,7 +37,7 @@ export const Icon: React.FC<React.PropsWithChildren<IconProps>> = ({
const IconComponent = icons[currentIconName];
return (
<span className={className} {...rest}>
<IconComponent className={styles[size]} />
<IconComponent size={size} />
</span>
);
};
9 changes: 0 additions & 9 deletions packages/components/src/Icon/styles.css.ts

This file was deleted.

8 changes: 7 additions & 1 deletion packages/components/src/Tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export interface TagProps {
size?: Size;
}

const iconSizeMap = {
small: 1,
medium: 2,
large: 3
};

/**
* Renders a Tag.
* @example
Expand Down Expand Up @@ -53,7 +59,7 @@ export const Tag: React.FC<React.PropsWithChildren<TagProps>> = ({
>
{iconName && (
<span className={styles.icon}>
<Icon name={iconName} size={size} />
<Icon name={iconName} size={iconSizeMap[size]} />
</span>
)}
{label}
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import './Grid/styles.css';
import './GridBase/styles.css';
import './HelpLinks/styles.css';
import './Hero/styles.css';
import './Icon/styles.css';
import './Impact/styles.css';
import './Link/styles.css';
import './LinkText/styles.css';
Expand Down
20 changes: 0 additions & 20 deletions packages/theme/src/icon/icons.css.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/theme/src/icon/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './icons.css';
export * from './icons';
16 changes: 0 additions & 16 deletions packages/theme/src/salt/salt.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@ createGlobalTheme('.saltAccordionSection', accordionVars, {
}
});

export const iconSizeVars = createGlobalThemeContract({
size: '--saltIcon-size-multiplier'
});

createGlobalTheme('.saltIcon', iconSizeVars, {
size: '1'
});

export const iconColorVars = createGlobalThemeContract({
fill: '--saltIcon-color'
});

createGlobalTheme('.saltIcon', iconColorVars, {
fill: 'currentColor'
});

const densities = [
'.salt-density-high',
'.salt-density-medium',
Expand Down
Loading