Skip to content

Commit baabd5f

Browse files
committed
Switch to Lucide icons
1 parent 47c03f1 commit baabd5f

File tree

8 files changed

+43
-33
lines changed

8 files changed

+43
-33
lines changed

apps/flourish-rapid/src/components/ThemeToggle/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const ThemeToggle = () => {
1414
)
1515

1616
const toggleTheme = () => {
17-
// theme === Theme.LIGHT ? setTheme(Theme.DARK) : setTheme(Theme.LIGHT)
1817
if (theme === Theme.LIGHT) {
1918
setTheme(Theme.DARK)
2019
localStorage.setItem('theme', Theme.DARK)

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/flourish-ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"flourish-release": "npm version patch"
3737
},
3838
"dependencies": {
39+
"lucide-react": "^0.536.0",
3940
"react-aria-components": "^1.4.0"
4041
},
4142
"devDependencies": {

packages/flourish-ui/src/components/Button/variants/IconBtn/__tests__/IconBtn.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { faXmark } from '@fortawesome/free-solid-svg-icons'
21
import '@testing-library/jest-dom'
3-
import { render, screen, fireEvent, createEvent } from '@testing-library/react'
2+
import { createEvent, fireEvent, render, screen } from '@testing-library/react'
3+
import { X } from 'lucide-react'
44
import React from 'react'
5-
import IconBtn, { getFontawesomeIconForIconType } from '..'
5+
import IconBtn, { getLucidIconComponent } from '..'
66

77
describe('<IconBtn />', () => {
88
it('renders without error', () => {
99
const wrapper = render(<IconBtn label="close the modal" />)
1010
expect(wrapper).not.toBeNull()
1111
})
1212

13-
it('getFontawesomeIconForIconType function works', () => {
14-
const resultWithCloseInput = getFontawesomeIconForIconType('close')
15-
expect(resultWithCloseInput).toEqual(faXmark)
13+
it('getLucidIconComponent function works', () => {
14+
const resultWithCloseInput = getLucidIconComponent('close')
15+
expect(resultWithCloseInput).toEqual(<X />)
1616
})
1717

1818
it('should fire click event provided to onClick prop when icon button is clicked', () => {

packages/flourish-ui/src/components/Button/variants/IconBtn/index.tsx

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
import {
2-
faXmark,
3-
faBars,
4-
faLightbulb,
5-
faSun,
6-
IconDefinition,
7-
faMoon
8-
} from '@fortawesome/free-solid-svg-icons'
9-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
10-
import React from 'react'
1+
import { X, Menu, Lightbulb, Sun, Moon } from 'lucide-react'
2+
import React, { ReactNode } from 'react'
113
import { CommonButtonProps } from '../..'
124
import {
135
classMerge,
@@ -38,22 +30,22 @@ interface IconBtnProps {
3830
label: string
3931
}
4032

41-
export const getFontawesomeIconForIconType = (
33+
export const getLucidIconComponent = (
4234
iconType: IconBtnProps['icon']
43-
): IconDefinition => {
35+
): ReactNode => {
4436
switch (iconType) {
4537
case 'close':
46-
return faXmark
38+
return <X />
4739
case 'bars':
48-
return faBars
40+
return <Menu />
4941
case 'light bulb':
50-
return faLightbulb
42+
return <Lightbulb />
5143
case 'sun':
52-
return faSun
44+
return <Sun />
5345
case 'moon':
54-
return faMoon
46+
return <Moon />
5547
default:
56-
return faXmark
48+
return <X />
5749
}
5850
}
5951

@@ -66,6 +58,7 @@ const IconBtn = ({
6658
style,
6759
'data-testId': testId
6860
}: CommonButtonProps & IconBtnProps) => {
61+
const lucidIconComponent = getLucidIconComponent(icon)
6962
return (
7063
<button
7164
className={classMerge('f-button', 'f-button-icon', className)}
@@ -81,7 +74,7 @@ const IconBtn = ({
8174
aria-label={label}
8275
disabled={disabled}
8376
>
84-
<FontAwesomeIcon icon={getFontawesomeIconForIconType(icon)} />
77+
{lucidIconComponent}
8578
</button>
8679
)
8780
}

packages/flourish-ui/src/components/Link/Link.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ a {
55
font:
66
calc($f-typography-fs-p * 1px) $f-typography-font-secondary,
77
serif;
8+
display: flex;
9+
align-items: center;
810
}
911

1012
.#{$prefix}icon-external {
1113
color: $f-color-secondary-light;
1214
margin-left: toRem($f-spacing-3);
15+
margin-top: toRem($f-spacing-3);
1316
}
1417

1518
.#{$prefix}dark-mode {

packages/flourish-ui/src/components/Link/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { faUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'
2-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
1+
import { ExternalLink } from 'lucide-react'
32
import React, { ReactNode } from 'react'
43
import { Customizable, Testable } from '../../common-props'
54
import { classMerge } from '../../utils'
@@ -37,7 +36,7 @@ export const Link = ({
3736
>
3837
{children}
3938
<span className="f-icon-external">
40-
<FontAwesomeIcon icon={faUpRightFromSquare} />
39+
<ExternalLink width={20} height={20} />
4140
</span>
4241
</a>
4342
) : (

packages/flourish-ui/src/components/Select/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { faCaretDown } from '@fortawesome/free-solid-svg-icons'
2-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
1+
import { ChevronDown } from 'lucide-react'
32
import React, {
43
FocusEvent,
54
KeyboardEvent,
@@ -177,10 +176,9 @@ export const Select = ({
177176
}}
178177
>
179178
{value}
180-
<FontAwesomeIcon
179+
<ChevronDown
181180
data-testid={`${testId}-caret`}
182181
className="f-select-caret"
183-
icon={faCaretDown}
184182
/>
185183
</button>
186184
<div

0 commit comments

Comments
 (0)