
No Comments Yet
Be the first to share your thoughts and start the conversation.
Be the first to share your thoughts and start the conversation.
Welcome to the very first active Lesson. This lesson builds on what you've learned so far, offering practical application and hands-on experience. π
Throughout this lesson, you'll encounter tasks, resources, and hints designed to enhance your understanding. Whether you're new to the topic or looking to deepen your knowledge, the lesson is for you. πͺ
Get ready to learn, practice, and develop your skills. Let's begin our journey into creating the complete LeftSidebar component! π
Your mission is to create the LeftSidebar component π£
Okay okay, I know we haven't done something like that before yet. However, that's what makes it exciting β the opportunity to think in terms of user interface.
Let's take a moment to consider how we can develop this LeftSidebar component. Here's my approach when I need to address such a task:
What do I need?
We need a sidebar that should consistently appear on the left side of all pages.
What's the content?
It consists of several links, arranged in a specific order.
What is the order of this content?
The first six links should be at the top, while the remaining two links should be at the bottom.
For responsiveness, what do I need to consider?
After a certain breakpoint, only icons should be displayed, with the link names hidden. Additionally, there should be another breakpoint where the LeftSidebar completely disappears.
What about styles?
I can go to Figma and refer to the styles such as spacing of the container, spacing between the links, spacing inside the link button, colors, shadows, border, etc.
See, that's how it works. You and try to find answer for that each piece of question and then finally you develop it step by step. So take a pause. And think in terms of UI.
Make sure that it's responsive and looks exactly similar to what is shown on the main deployed site for Figma Design.
P.S., the LogIn and SignUp buttons should only appear if the user is not logged in.
To give you a clearer picture, here's how it should be:
Some valuable resources to assist you with the task and deepen your understanding of a concept
Be sure to check them out to gain deeper insights into this topic! π
Stuck? Don't worry, it means you're trying πͺ
Here are a hint to nudge you in the right direction:
Let's start step by step.
What do I need?
A sidebar that should consistently appear on the left side of all pages.
How can I do it?
In CSS, there is a position property which lets you give any kind of position to any element in the DOM.
Try each of these (especially Relative Absolute, Fixed, and Sticky) one by one. Examine the results and effects of all these and choose the best one.
Tip: We want a Sidebar that will stick to the left side all the time
Displaying Content
If we observe closely, we'll notice that the first six links are positioned at the top, while the remaining two are aligned at the bottom. Essentially, we have two groups placed in different positions.
How to do that?
Time to flex! Yes, the CSS flexbox. It's a way in CSS to arrange things on a web page, so they fit nicely no matter how big or small the screen is.
It has various properties:
Now think, in which direction these two groups are?
Yes, column! So we should use the Flex Direction property here.
But how to keep them away? One at the start and the other at the bottom?
We want to spread these items so they are aligned at the edges. Luckily, there is one flex box property that spreads the children in equal space.
If you're new to CSS, these might seem a bit tricky at first but don't be discouraged.
I didn't know this either until I looked it upThis is the perfect time to do that. Check the resources section above and read the Flexbox guide to discover the property we need.
Remember - Nothing comes directly to mind. Either you know by someone or you do the hard part, i.e., Search.
How to display the Active State?
Is there a way to find out the current URL in Next.js? GOOGLE IT!
Absolutely, you can use the usePathname() hook. With this hook, you can easily retrieve the current URL of the page.
There you go. Now you know what to do. Simply call the hook and check if the Link of a particular item is the same as the current URL we will get from the Next.js Hook!
What about styles?
When it comes to styling, let's head over to Figma. Click on the element, and make a note of all the values we'll require. I will start,
... (you got this)
How to achieve Responsiveness?
In CSS, we make websites work well on different screens using something called Media Queries. It's like giving instructions for how things should look on big and small screens.
For example, we can say that when the screen is smaller than 640 pixels, make the text bigger or change its color.
This way, we can make websites look good on all sorts of devices, like phones and computers.
Go back to the Resouces section to see how we can use Media Queries in TailwindCSS.
Right after that, ask yourself: To achieve responsiveness of LeftSidebar, which property do I have to change at a certain breakpoint?
If you successfully completed the task, congratulations on completing this active lesson π. You're on the right path to becoming an expert developer π
For those who faced some difficulties, remember that learning is a journey, and challenges are opportunities for growth. Keep trying, and you'll get there
You've got this! πͺπ
If youβre checking out this lesson in preview but havenβt joined the course yet, what are you WAITING for?
Dive in, get your hands coding, and experience the way of learning