27
loading...
This website collects cookies to deliver better user experience
background-image : url(/xyz.jpg);
in my CSS.And now the components overlap as I wished. It worked fine but a new problem arrived at the same moment. The background image is zoomed to its maximum height and width. To overcome this , I wrote background-size : cover;
which I think worked best for me.Navbar
component. It worked fine😊.React Typist
. You can also try this on by going to the npm site.Type
component. And by reading their documentation , I easily applied that on my App.sound
component in my App. And the package I used is react-audio-player
from npm. And by applying some changes to the code, now I can see audio bar on my App. Programmers ability is - whenever they face any problem in their code. They Google.
During the time of coding if you ever stuck in a problem for a long time. Just think from the start again and ask yourself the 5 W's and H. Then you will definitely find your way.
@media queries
. I wrote pretty well @media queries
. After writing @media queries
I was sure that this App is not made for portrait phones. Then I thought that why shouldn't I make a prompt that makes the user rotate his/her phone. After that, my brain cells start working on that thing. And again, the first problem arose, that is, my component isn't overlapping. Then I Googled the best way to ask a user to rotate his/her phone. But the answers are for React-native. I was working on React only. So after some more Googling, I came across a package that gets the orientation from the user.use-window-orientation
. Gotoscreen.height
and screen.width
to get the pixels information and do this"if (screen.width > screen.height ) {
return landscape;
} else {
return portrait;
}
const { portrait } = useWindowOrientation();
if (portrait) {
return <Rotate />
}
else {
return (
<div className = "Home">
<Navbar />
<Type />
<Music />
</div>
)
}
The beginning is the end and the end is the beginning.