diff --git a/client/src/assets/icons/chapter-icon.tsx b/client/src/assets/icons/chapter-icon.tsx new file mode 100644 index 00000000000..53fe7dbbc13 --- /dev/null +++ b/client/src/assets/icons/chapter-icon.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import { FsdChapters } from '../../../../shared/config/chapters'; +import DatabaseIcon from './database'; +import JavaScriptIcon from './javascript'; +import ReactIcon from './react'; +import ResponsiveDesign from './responsive-design'; +import FreeCodeCampIcon from './freecodecamp-icon'; +import Html from './html'; +import Css from './css'; + +const iconMap = { + freecodecamp: FreeCodeCampIcon, + html: Html, + css: Css, + javascript: JavaScriptIcon, + 'frontend-libraries': ReactIcon, + 'relational-databases': DatabaseIcon, + 'security-and-privacy': ResponsiveDesign +}; + +type ChapterIconProps = { + chapter: FsdChapters; +} & React.SVGProps; + +export function ChapterIcon(props: ChapterIconProps): JSX.Element { + const { chapter, ...iconProps } = props; + // fallback to RWD Icon + const Icon = iconMap[chapter] ?? ResponsiveDesign; + + return ; +} diff --git a/client/src/assets/icons/css.tsx b/client/src/assets/icons/css.tsx new file mode 100644 index 00000000000..95bdab948c6 --- /dev/null +++ b/client/src/assets/icons/css.tsx @@ -0,0 +1,15 @@ +import React from 'react'; + +function Css( + props: JSX.IntrinsicAttributes & React.SVGProps +): JSX.Element { + return ( + + + + ); +} + +Css.displayName = 'Css'; + +export default Css; diff --git a/client/src/assets/icons/freecodecamp-icon.tsx b/client/src/assets/icons/freecodecamp-icon.tsx new file mode 100644 index 00000000000..1316044a46b --- /dev/null +++ b/client/src/assets/icons/freecodecamp-icon.tsx @@ -0,0 +1,15 @@ +import React from 'react'; + +function FreeCodeCampIcon( + props: JSX.IntrinsicAttributes & React.SVGProps +): JSX.Element { + return ( + + + + ); +} + +FreeCodeCampIcon.displayName = 'FreeCodeCampIcon'; + +export default FreeCodeCampIcon; diff --git a/client/src/assets/icons/html.tsx b/client/src/assets/icons/html.tsx new file mode 100644 index 00000000000..a9e0ae5aeb8 --- /dev/null +++ b/client/src/assets/icons/html.tsx @@ -0,0 +1,15 @@ +import React from 'react'; + +function Html( + props: JSX.IntrinsicAttributes & React.SVGProps +): JSX.Element { + return ( + + + + ); +} + +Html.displayName = 'Html'; + +export default Html; diff --git a/client/src/templates/Introduction/components/super-block-accordion.css b/client/src/templates/Introduction/components/super-block-accordion.css index 57c098c9406..66db203648e 100644 --- a/client/src/templates/Introduction/components/super-block-accordion.css +++ b/client/src/templates/Introduction/components/super-block-accordion.css @@ -27,18 +27,24 @@ border: none; background-color: transparent; width: 100%; - text-align: start; padding: 16px; display: flex; align-items: center; justify-content: space-between; } +.super-block-accordion .chapter-button .chapter-icon-and-text { + display: flex; + align-items: center; + column-gap: 10px; + font-size: 1.5em; +} + .super-block-accordion .module-button { border: none; background-color: transparent; width: 100%; - text-align: start; + font-size: 1.25em; padding: 16px; display: flex; align-items: center; diff --git a/client/src/templates/Introduction/components/super-block-accordion.tsx b/client/src/templates/Introduction/components/super-block-accordion.tsx index c1c25b2a0c2..3aa61b4a437 100644 --- a/client/src/templates/Introduction/components/super-block-accordion.tsx +++ b/client/src/templates/Introduction/components/super-block-accordion.tsx @@ -10,6 +10,8 @@ import DropDown from '../../../assets/icons/dropdown'; // TODO: See if there's a nice way to incorporate the structure into data Gatsby // sources from the curriculum, rather than importing it directly. import superBlockStructure from '../../../../../curriculum/superblock-structure/full-stack.json'; +import { ChapterIcon } from '../../../assets/icons/chapter-icon'; +import { FsdChapters } from '../../../../../shared/config/chapters'; import Block from './block'; import './super-block-accordion.css'; @@ -55,7 +57,13 @@ const Chapter = ({ dashedName, children, isExpanded }: ChapterProps) => { return ( - {t(`intro:full-stack-developer.chapters.${dashedName}`)} +
+ + {t(`intro:full-stack-developer.chapters.${dashedName}`)} +
diff --git a/shared/config/chapters.ts b/shared/config/chapters.ts new file mode 100644 index 00000000000..577ef7474c9 --- /dev/null +++ b/shared/config/chapters.ts @@ -0,0 +1,9 @@ +// TODO: Dynamically create these from intro.json or full-stack.json +export enum FsdChapters { + Welcome = 'freecodecamp', + Html = 'html', + Css = 'css', + Javascript = 'javascript', + RelationalDatabases = 'relational-databases', + Security = 'security-and-privacy' +}