-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
560-refactor: Widget principles (#636)
* refactor: 560 - principles scss to modules * refactor: 560 - principle card to scss modules * refactor: 560 - move principles to separate folder * refactor: 560 - replace divs with semantic tags * fix: 560 - test issue * refactor: 560 - replace interface with type * refactor: 560 - move data to dev-data folder * refactor: 560 - remove unnecessary z-indexes * refactor: 560 - remove file extensions from import statements * fix: 560 - test case
- Loading branch information
Showing
14 changed files
with
104 additions
and
131 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
15 changes: 9 additions & 6 deletions
15
src/widgets/principles/constants.tsx → dev-data/principle-cards.data.tsx
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 |
---|---|---|
@@ -1,23 +1,26 @@ | ||
import { PrincipleCardProps } from './ui/principle-card/principle-card'; | ||
import { OpenSourcePhilosophyIcon, OpenToEveryoneIcon, TeachItForwardIcon } from '@/shared/icons'; | ||
import Image from 'next/image'; | ||
import openSourcePhilosophyIcon from '@/shared/assets/svg/openSourcePhilosophyIcon.svg'; | ||
import openToEveryoneIcon from '@/shared/assets/svg/openToEveryoneIcon.svg'; | ||
import teachItForwardIcon from '@/shared/assets/svg/teachItForwardIcon.svg'; | ||
import { PrincipleCard } from '@/widgets/principles'; | ||
|
||
export const cards: PrincipleCardProps[] = [ | ||
export const principleCards: PrincipleCard[] = [ | ||
{ | ||
title: 'Open to everyone', | ||
description: | ||
'Free courses, no obligations, and no contracts. No age limit. Only students’ time and dedication are required. Students can repeatedly attend courses.', | ||
icon: <OpenToEveryoneIcon />, | ||
icon: <Image src={openToEveryoneIcon} alt="" aria-hidden="true" />, | ||
}, | ||
{ | ||
title: 'Open source philosophy', | ||
description: | ||
'Our Learning Management System platform and educational materials are publicly available on GitHub and YouTube.', | ||
icon: <OpenSourcePhilosophyIcon />, | ||
icon: <Image src={openSourcePhilosophyIcon} alt="" aria-hidden="true" />, | ||
}, | ||
{ | ||
title: '"Teach it forward"', | ||
description: | ||
'Students study at school for free, but we request that they return as mentors to pass on their knowledge to the next generation of students.', | ||
icon: <TeachItForwardIcon />, | ||
icon: <Image src={teachItForwardIcon} alt="" aria-hidden="true" />, | ||
}, | ||
]; |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { Principles } from './ui/principle-card/principles'; | ||
export type { PrincipleCard } from './types'; | ||
export { Principles } from './ui/principles/principles'; |
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,7 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
export type PrincipleCard = { | ||
title: string; | ||
description: string; | ||
icon: ReactNode; | ||
}; |
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
31 changes: 12 additions & 19 deletions
31
src/widgets/principles/ui/principle-card/principle-card.tsx
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 |
---|---|---|
@@ -1,23 +1,16 @@ | ||
import { ReactNode } from 'react'; | ||
import classnames from 'classnames/bind'; | ||
import { Paragraph } from '@/shared/ui/paragraph'; | ||
import { WidgetTitle } from '@/shared/ui/widget-title'; | ||
import type { PrincipleCard as TPrincipleCard } from '@/widgets/principles'; | ||
|
||
import './principle-card.scss'; | ||
import styles from './principle-card.module.scss'; | ||
|
||
export interface PrincipleCardProps { | ||
title: string; | ||
description: string; | ||
icon: ReactNode; | ||
} | ||
const cx = classnames.bind(styles); | ||
|
||
export const PrincipleCard = ({ title, description, icon }: PrincipleCardProps) => ( | ||
<div className="principle-card"> | ||
<div className="card-header"> | ||
<div className="icon-wrapper"> | ||
<div className="accent" /> | ||
<span>{icon}</span> | ||
</div> | ||
<div className="card-title">{title}</div> | ||
</div> | ||
<div className="card-description">{description}</div> | ||
<div className="accent-corner" /> | ||
</div> | ||
export const PrincipleCard = ({ title, description, icon }: TPrincipleCard) => ( | ||
<article className={cx('principle-card')} data-testid="principle-card"> | ||
<span className={cx('icon')}>{icon}</span> | ||
<WidgetTitle className={cx('card-title')}>{title}</WidgetTitle> | ||
<Paragraph className={cx('card-description')}>{description}</Paragraph> | ||
</article> | ||
); |
This file was deleted.
Oops, something went wrong.
14 changes: 1 addition & 13 deletions
14
...nciples/ui/principle-card/principles.scss → ...ples/ui/principles/principles.module.scss
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,23 @@ | ||
import classnames from 'classnames/bind'; | ||
import { WidgetTitle } from '@/shared/ui/widget-title'; | ||
import { PrincipleCard } from '@/widgets/principles/ui/principle-card/principle-card.tsx'; | ||
import { principleCards } from 'data'; | ||
|
||
import styles from './principles.module.scss'; | ||
|
||
const cx = classnames.bind(styles); | ||
|
||
export const Principles = () => ( | ||
<section className={cx('principles', 'container')}> | ||
<div className={cx('principles', 'content')}> | ||
<WidgetTitle size="large" mods="lines"> | ||
RS School Principles are an ability to complete our mission | ||
</WidgetTitle> | ||
<div className={cx('column-3', 'cards')}> | ||
{principleCards.map(({ title, description, icon }) => ( | ||
<PrincipleCard key={title} description={description} icon={icon} title={title} /> | ||
))} | ||
</div> | ||
</div> | ||
</section> | ||
); |