This is a solution to the 3-column preview card component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Users should be able to:
- View the optimal layout depending on their device's screen size
- See hover states for interactive elements
- Have node JS installed.
- In the project root directory, run
npm install
- In the project root directory, run
npm run start
- HTML5 markup
- SCSS - advanced variant of CSS
- React - JS library
- React Icons - Include popular icons in your React projects easily with react-icons
- TypeScript - Strongly typed programming language for JS
Using render props to implement DRY approach
<MainWrapper>
<LearnMoreClickedWrapper
render={(learnMoreClicked, onLearnMoreBtnClick) => (
<Sedan
learnMoreClicked={learnMoreClicked}
onLearnMoreBtnClick={onLearnMoreBtnClick}
/>
)}
/>
<LearnMoreClickedWrapper
render={(learnMoreClicked, onLearnMoreBtnClick) => (
<Suv
learnMoreClicked={learnMoreClicked}
onLearnMoreBtnClick={onLearnMoreBtnClick}
/>
)}
/>
<LearnMoreClickedWrapper
render={(learnMoreClicked, onLearnMoreBtnClick) => (
<Luxury
learnMoreClicked={learnMoreClicked}
onLearnMoreBtnClick={onLearnMoreBtnClick}
/>
)}
/>
</MainWrapper>
const LearnMoreClickedWrapper = ({ render }: ILearnMoreClickedWrapper) => {
const [learnMoreClicked, setLearnMoreClicked] = useState<boolean>(false);
const onLearnMoreBtnClick = (): void => {
setLearnMoreClicked(!learnMoreClicked);
};
return (
<div className="learn-more-clicked-wrapper">
{render(learnMoreClicked, onLearnMoreBtnClick)}
</div>
);
};
Learning more about SCSS and using it in future projects
- TypeScript Docs - Docs to better understand typescript
- JavaScript Docs - JS docs
- w3schools CSS docs - Great documentation to understand CSS
- w3schools HTML docs - Great documentation to understand HTML
- ReactJS - Great documentation to understand ReactJS
- Frontend Mentor - lauriselvijs