Skip to content

Commit

Permalink
[TUI-67] add regular weight icons (#373)
Browse files Browse the repository at this point in the history
* [TUI-67] Added icons weight regular
  • Loading branch information
lghiur authored Jun 27, 2024
1 parent 9e8a8df commit 676e822
Show file tree
Hide file tree
Showing 35 changed files with 83 additions and 56 deletions.
Binary file added lib/fonts/fontawesome/fa-regular-400.ttf
Binary file not shown.
Binary file added lib/fonts/fontawesome/fa-regular-400.woff2
Binary file not shown.
6 changes: 6 additions & 0 deletions lib/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/index.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions lib/tyk-ui.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/tyk-ui.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/tyk-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/tyk-ui.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tyk-technologies/tyk-ui",
"version": "4.1.0",
"version": "4.1.1",
"description": "Tyk UI - ui reusable components",
"main": "src/index.js",
"scripts": {
Expand Down
19 changes: 19 additions & 0 deletions src/common/css/fontawesome/regular.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*!
* Font Awesome Pro 6.5.2 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license (Commercial License)
* Copyright 2024 Fonticons, Inc.
*/
:root, :host {
--fa-style-family-classic: 'Font Awesome 6 Pro';
--fa-font-regular: normal 400 1em/1 'Font Awesome 6 Pro'; }

@font-face {
font-family: 'Font Awesome 6 Pro';
font-style: normal;
font-weight: 400;
font-display: block;
src: url("../../fonts/fontawesome/fa-regular-400.woff2") format("woff2"), url("../../fonts/fontawesome/fa-regular-400.ttf") format("truetype"); }

.far,
.fa-regular {
font-weight: 400; }
Binary file added src/common/fonts/fontawesome/fa-regular-400.ttf
Binary file not shown.
Binary file not shown.
4 changes: 1 addition & 3 deletions src/components/Button/Button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('Button', () => {
<Button
theme="default"
iconType="copy"
iconFamily="tykon"
iconPosition="right"
>
{buttonText}
Expand All @@ -46,8 +45,7 @@ describe('Button', () => {
.should('have.class', 'icon-right')

.get('.tyk-icon')
.should('have.class', 'tykon')
.and('have.class', 'tykon-copy');
.and('have.class', 'fa-copy');
});

it('renders a custom "button"', () => {
Expand Down
10 changes: 5 additions & 5 deletions src/components/Card/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Row from '../../layout/Row';
)}
>
<>
<Icon type="circle" className="text--success" />
<Icon type="circle-check" weight="solid" className="text--success" />
<span className="left-buffer-small">Is Active</span>
</>
</Card.Header>
Expand All @@ -46,7 +46,7 @@ import Row from '../../layout/Row';
)}
>
<>
<Icon type="circle" className="text--success" />
<Icon type="circle-check" weight="solid" className="text--success" />
<span className="left-buffer-small">Is Active</span>
</>
</Card.Header>
Expand Down Expand Up @@ -76,7 +76,7 @@ import Row from '../../layout/Row';
)}
>
<>
<Icon type="circle" className="text--success" />
<Icon type="circle-check" weight="solid" className="text--success" />
<span className="left-buffer-small">Is Active</span>
</>
</Card.Header>
Expand All @@ -103,7 +103,7 @@ import Row from '../../layout/Row';
)}
>
<>
<Icon type="circle" className="text--success" />
<Icon type="circle-check" weight="solid" className="text--success" />
<span className="left-buffer-small">Is Active</span>
</>
</Card.Header>
Expand Down Expand Up @@ -173,7 +173,7 @@ import Row from '../../layout/Row';
)}
>
<>
<Icon type="circle" className="text--success" />
<Icon type="circle-check" weight="solid" className="text--success" />
<span className="left-buffer-small">Is Active</span>
</>
</Card.Header>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Icon/Icon.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from 'react';
import Icon from './index';

describe('Icon', () => {
const faFamily = 'fa-light';
const faFamily = 'fa-regular';
const faFamilySolid = 'fa-solid';
const tykonFamily = 'tykon';
const selectors = {
icon: '.tyk-icon',
};

it('renders an icon and the default family is "fa-light"', () => {
it('renders an icon and the default family is "fa-regular"', () => {
cy.mount(<Icon type="edit" />)
.get(selectors.icon)
.should('exist')
Expand Down
4 changes: 2 additions & 2 deletions src/components/Icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function Icon({
}) {
function getCSSClasses() {
const fontFamily = family || 'fa';
const fontWeight = fontFamily === 'fa' ? `fa-${weight || 'light'}` : '';
const fontWeight = fontFamily === 'fa' ? `fa-${weight || 'regular'}` : '';

return [
'tyk-icon',
Expand All @@ -31,7 +31,7 @@ Icon.propTypes = {
family: PropTypes.string,
// Icon type to use
type: PropTypes.string.isRequired,
// Icon weight to use. Only applicable for Font Awesome icons. Default is 'light'. Also supports 'solid'
// Icon weight to use. Only applicable for Font Awesome icons. Default is 'regular'. Also supports 'light' and 'solid'
weight: PropTypes.string
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Message/Message.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Message', () => {
const noMarginClass = 'no-margin';
const selectors = {
message: '.tyk-message',
closeIcon: '.tyk-icon.tykon-x',
closeIcon: '.tyk-icon.fa-xmark',
};

it('renders the component with the info theme by default', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ function Message({
].filter(Boolean).join(' ');
}

const iconType = theme === 'success' ? 'check' : 'warning';
const iconType = theme === 'success' ? 'check' : 'exclamation';

return (
<div className={getCssClasses()}>
<Icon family="tykon" type={iconType} />
<Icon type={iconType} />
<div className="tyk-message__content">
{ children }
</div>
{onClose && (
<Icon family="tykon" type="x" onClick={onClose} />
<Icon type="xmark" onClick={onClose} />
)}
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ function Modal({

const themeIcon = {
success: 'check',
warning: 'warning',
danger: 'delete',
warning: 'exclamation',
danger: 'exclamation',
}[theme];

return (
Expand All @@ -54,7 +54,7 @@ function Modal({
<div className="tyk-modal__content">
{theme !== 'none' && (
<div className="tyk-modal__theme-header">
<Icon family="tykon" type={themeIcon} />
<Icon type={themeIcon} />
</div>
)}
{ children }
Expand Down
8 changes: 4 additions & 4 deletions src/components/Pill/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Button from '../Button';
Pill Two
</Pill>
<Pill theme="danger">
<span>Pill Three</span><Button noStyle={true} iconOnly={true} iconType="times" size="fit" type="button" />
<span>Pill Three</span><Button noStyle={true} iconOnly={true} iconType="xmark" size="fit" type="button" />
</Pill>
<Pill theme="warning">
Pill Four
Expand All @@ -34,7 +34,7 @@ import Button from '../Button';
Pill Two
</Pill>
<Pill theme="danger-outline">
<span>Pill Three</span><Button noStyle={true} iconOnly={true} iconType="times" size="fit" type="button" />
<span>Pill Three</span><Button noStyle={true} iconOnly={true} iconType="xmark" size="fit" type="button" />
</Pill>
<Pill theme="warning-outline">
Pill Four
Expand All @@ -58,7 +58,7 @@ import Button from '../Button';
Pill Two
</Pill>
<Pill theme="danger square">
<span>Pill Three</span><Button noStyle={true} iconOnly={true} iconType="times" size="fit" type="button" />
<span>Pill Three</span><Button noStyle={true} iconOnly={true} iconType="xmark" size="fit" type="button" />
</Pill>
<Pill theme="warning square">
Pill Four
Expand All @@ -78,7 +78,7 @@ import Button from '../Button';
Pill Two
</Pill>
<Pill theme="danger-outline square">
<span>Pill Three</span><Button noStyle={true} iconOnly={true} iconType="times" size="fit" type="button" />
<span>Pill Three</span><Button noStyle={true} iconOnly={true} iconType="xmark" size="fit" type="button" />
</Pill>
<Pill theme="warning-outline square">
Pill Four
Expand Down
4 changes: 2 additions & 2 deletions src/components/Table/Table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ describe('Table Component Rendering', () => {
const selectors = {
table: '.tyk-table',
headerCell: '.tyk-table thead th',
sortIcon: '.tyk-table thead th .tykon-arrowsort',
sortIconClassName: '.tykon-arrowsort',
sortIcon: '.tyk-table thead th .fa-sort',
sortIconClassName: '.fa-sort',
selectAllCheckbox: '.tyk-table thead input[type="checkbox"]',
allRowCheckboxes: '.tyk-table tbody input[type="checkbox"]',
row: '.tyk-table tbody tr',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/js/header-cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function HeaderCell({ column }) {
{column.name}
{column.sortable && (
<span className="header-sort">
<Icon family="tykon" type="arrowsort" />
<Icon type="sort" />
</span>
)}
</th>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Toast/Toast.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ describe('Toast', () => {
},
icons: {
icon: 'tyk-icon',
success: 'tykon-check',
warning: 'tykon-warning',
success: 'fa-check',
warning: 'fa-exclamation',
},
};

Expand All @@ -55,7 +55,7 @@ describe('Toast', () => {
};

it('should render toast components and remove it after the given delay', () => {
cy.mount(<Component onClick={() => toast.notify('demo', { delay: 150 })} />)
cy.mount(<Component onClick={() => toast.notify('demo', { delay: 350 })} />)
.get('button')
.click();

Expand Down
8 changes: 4 additions & 4 deletions src/components/Tooltip/Tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ describe('Tooltip', () => {
tooltipWrapper: 'tyk-tooltip__wrapper',
tooltip: 'tyk-tooltip',
content: 'tooltip-content',
iconHelp: 'tykon-help',
iconClose: 'tykon-x',
iconHelp: 'fa-question',
iconClose: 'fa-xmark',
};
function Component(props) {
return (
Expand Down Expand Up @@ -85,13 +85,13 @@ describe('Tooltip', () => {
.find(`.${classes.iconHelp}`)
.should('exist');

cy.mount(<Component render="hello" icon={<Icon family="tykon" type="check" />} />);
cy.mount(<Component render="hello" icon={<Icon type="check" />} />);
cy.get(`.${classes.content}`)
.trigger('mouseover');

cy.get(`.${classes.tooltip} .${classes.iconHelp}`)
.should('not.exist')
.get(`.${classes.tooltip} .tykon-check`)
.get(`.${classes.tooltip} .fa-check`)
.should('exist');
});

Expand Down
5 changes: 2 additions & 3 deletions src/components/Tooltip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function Tooltip({
<div className={classes} ref={tooltipRef}>
{icon && (
icon === true ? (
<Icon family="tykon" type="help" />
<Icon type="question" />
) : (
icon
)
Expand All @@ -78,8 +78,7 @@ function Tooltip({
</div>
{closable && (
<Icon
family="tykon"
type="x"
type="xmark"
onClick={(e) => {
e.stopPropagation();
setIsActive(false);
Expand Down
6 changes: 3 additions & 3 deletions src/form/components/Combobox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ class Combobox extends Component {
onClick={this.handlePillRemoveClick.bind(this, index)}
aria-label="remove"
>
<Icon type="times" />
<Icon type="xmark" />
</button>
<span>{ value.name }</span>
</li>
Expand Down Expand Up @@ -634,7 +634,7 @@ class Combobox extends Component {
{filteredValues.length > 0 && (
<Button
className="tyk-combobox--with-tags__button-down"
iconType="arrow-down"
iconType="chevron-down"
iconOnly
onClick={this.handleComboboxDropdownClick}
/>
Expand All @@ -649,7 +649,7 @@ class Combobox extends Component {
onKeyDown={() => {}}
>
{ this.getComboboxDisplayData() }
<Icon family="tykon" type="arrowdown" />
<Icon type="chevron-down" />
</li>
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/form/components/Combobox2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ function Combobox2({

const renderIcon = useCallback(
() => (expandMode
? <Icon type={valuesExpanded ? 'compress-arrows-alt' : 'expand-arrows-alt'} />
: <Icon family="tykon" type="arrowdown" />
? <Icon type={valuesExpanded ? 'chevron-down' : 'chevron-up'} />
: <Icon type="chevron-down" />
),
[expandMode, valuesExpanded],
);
Expand Down
2 changes: 1 addition & 1 deletion src/form/components/Dropdown2/Dropdown.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Dropdown2', () => {
buttonGroup: '.tyk-button-group',
dropdownTrigger: '.dropdown__trigger',
btn: '.tyk-button',
arrowIcon: '.tykon-arrowdown',
arrowIcon: '.fa-chevron-down',
dropdownListWrapper: '.tyk-list',
};
it('renders by default a button with an arrow', () => {
Expand Down
6 changes: 2 additions & 4 deletions src/form/components/Dropdown2/DropdownTrigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ function DropdownTrigger({
!splitTrigger ? (
<Button
className="dropdown__trigger"
iconType="arrowdown"
iconFamily="tykon"
iconType="chevron-down"
iconPosition="right"
theme={theme}
ref={ref}
Expand All @@ -35,8 +34,7 @@ function DropdownTrigger({
</Button>
<Button
className="dropdown__trigger"
iconType="arrowdown"
iconFamily="tykon"
iconType="chevron-down"
iconPosition="right"
theme={theme}
onClick={toggle}
Expand Down
2 changes: 1 addition & 1 deletion src/form/components/EditableList2/FieldsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function FieldsList({
<div className={`editable-list__item-cell editable-list__item-action ${readOnly && 'editable-list__item-action--read-only'}`}>
<Button
iconOnly
iconType="trash-alt"
iconType="trash"
theme="primary-link"
onClick={onDelete}
disabled={readOnly || disabled}
Expand Down
Loading

0 comments on commit 676e822

Please sign in to comment.