forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: organise icons (freeCodeCamp#57498)
- Loading branch information
1 parent
4b4aa2b
commit 70f20b9
Showing
14 changed files
with
185 additions
and
198 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import { FsdChapters } from '../../../shared/config/chapters'; | ||
import DatabaseIcon from './icons/database'; | ||
import JavaScriptIcon from './icons/javascript'; | ||
import ReactIcon from './icons/react'; | ||
import ResponsiveDesign from './icons/responsive-design'; | ||
import FreeCodeCampIcon from './icons/freecodecamp'; | ||
import Html from './icons/html'; | ||
import Css from './icons/css'; | ||
|
||
const iconMap = { | ||
[FsdChapters.Welcome]: FreeCodeCampIcon, | ||
[FsdChapters.Html]: Html, | ||
[FsdChapters.Css]: Css, | ||
[FsdChapters.Javascript]: JavaScriptIcon, | ||
[FsdChapters.FrontendLibraries]: ReactIcon, | ||
[FsdChapters.RelationalDatabases]: DatabaseIcon, | ||
[FsdChapters.Security]: ResponsiveDesign | ||
}; | ||
|
||
type ChapterIconProps = { | ||
chapter: FsdChapters; | ||
} & React.SVGProps<SVGSVGElement>; | ||
|
||
export function ChapterIcon(props: ChapterIconProps): JSX.Element { | ||
const { chapter, ...iconProps } = props; | ||
const Icon = iconMap[chapter] ?? ResponsiveDesign; | ||
|
||
return <Icon {...iconProps} />; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
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