Skip to content

Commit

Permalink
fix: Apply {display: none;} and {flex} to '$homepage' element and '.h…
Browse files Browse the repository at this point in the history
…omepage' class

In 'HomePage.tsx':
- Apply {display: flex;}to the '$homepage' element
 to control its visibility and layout after it has been mounted.

In 'HomePage.scss':
- Add {display: none;} to the '.homepage' class to ensure it remains
 hidden initially.
- Adjust the responsive styles to control the 'flex-direction'
 of the '.homepage' class as needed.

This fix resolves the issue where the 'HomePage' component briefly
appears on the screen before the 'blend-in-out' animation is applied.
  • Loading branch information
ITurres committed Sep 8, 2023
1 parent fe3cf37 commit b6cbdeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const HomePage = () => {
useEffect(() => {
const $homepage = document.querySelector<HTMLDivElement>('#homepage');
if ($homepage) {
$homepage.style.display = 'flex'; // ?overrides the {display: none} on 'HomePage.scss'. This is to prevent the homepage from showing before animation is applied.
$homepage.classList.add('blend-in-out');
}
});
Expand Down
5 changes: 4 additions & 1 deletion src/styles/pages/HomePage.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
@import '../_mixins.scss';

.homepage {
display: none;
flex-direction: column;

@include component-code-snippet('const HomePage = () => {');

user-select: none;
Expand Down Expand Up @@ -57,7 +60,7 @@
}

@media (min-width: 768px) {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 100vh;
Expand Down

0 comments on commit b6cbdeb

Please sign in to comment.