-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(icon): Add joinClassNames utility
And tweaked deprecation warnings
- Loading branch information
Showing
5 changed files
with
40 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import joinClassNames from '../joinClassNames' | ||
|
||
describe('joinClassNames', () => { | ||
it('joins class names with a space in between', () => { | ||
const classes = joinClassNames('class-1', 'class-2') | ||
|
||
expect(classes).toEqual('class-1 class-2') | ||
}) | ||
|
||
it('removes empties', () => { | ||
const classes = joinClassNames('class-1', '', undefined, false, null, 'class-2') | ||
|
||
expect(classes).toEqual('class-1 class-2') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const joinClassNames = (...classes) => classes.filter(className => className).join(' ') | ||
|
||
export default joinClassNames |