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

[TUI-67] add regular weight icons #373

Merged
merged 5 commits into from
Jun 27, 2024
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
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.
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
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
2 changes: 1 addition & 1 deletion src/components/Tooltip/Tooltip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ 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');

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
4 changes: 2 additions & 2 deletions src/form/components/Dropdown2/DropdownTrigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function DropdownTrigger({
!splitTrigger ? (
<Button
className="dropdown__trigger"
iconType="arrowdown"
iconType="chevron-down"
iconFamily="tykon"
iconPosition="right"
theme={theme}
Expand All @@ -35,7 +35,7 @@ function DropdownTrigger({
</Button>
<Button
className="dropdown__trigger"
iconType="arrowdown"
iconType="chevron-down"
iconFamily="tykon"
iconPosition="right"
theme={theme}
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
2 changes: 1 addition & 1 deletion src/form/components/FileInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function FileInput({
type="button"
aria-label="clear value"
>
<Icon type="times" />
<Icon type="xmark" />
</button>
)
: null
Expand Down
2 changes: 1 addition & 1 deletion src/form/components/Multiselect/js/MultiselectPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function MultiselectPanel({
<div className="tyk-multiselect__panel">
<Input
inputgroupaddonleft={
<Icon type="search" />
<Icon type="magnifying-glass" />
}
name="search"
onChange={searchOnChange}
Expand Down
1 change: 1 addition & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@import './common/css/grid.css';
@import './common/css/fonts.css';
@import './common/css/fontawesome/light.css';
@import './common/css/fontawesome/regular.css';
@import './common/css/fontawesome/solid.css';
@import './common/css/fontawesome/fontawesome.css';
@import './common/css/tykon.css';
Expand Down
Loading