This is a solution to the Single-page design portfolio challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.
Note: Delete this note and update the table of contents based on what sections you keep.
Users should be able to:
- View the optimal layout for the site depending on their device's screen size
- See hover states for all interactive elements on the page
- Navigate the slider using either their mouse/trackpad or keyboard
- Semantic HTML5 markup
- CSS custom properties
- Flexbox
- CSS Grid
- Next.js - React framework
This project is similar to previous projects, in terms of layout challenge and responsivenss that i have done in Front-end-mentor. The only aspect that is reletively new is the scroll image slider. I did not import any new or specific libraries to acheive this. I just used react library useRef to access DOM elements and to control the scroll of a component.
To see how you can add code snippets, see below:
const moveLeft = () => {
const el = ref.current;
setSlideLeft((el.scrollLeft -= 300));
const elprev = ref.current.scrollLeft;
if (elprev === 0) {
if (hidebtnright === false) {
setHidebtnright(true);
}
}
};
I want to further continue using next js in future projects and excel in it.
- Example resource 1 - This helped me understand the basic structure of a scroll image slider.
- Example resource 2 - This is helped mer understand the logic behind scroll image slider
- Website - Basma Tebe
- Frontend Mentor - @btebe
Note: Delete this note and add/remove/edit lines above based on what links you'd like to share.
I would like to thank Santiago Torres for posting an example of scroll image slider on code pen. I also woudl like to thank Asim Hafeez for posting an example of scroll logic in react.