Browse Source

fix(blog): blog-content animates in correctly on mobile

Signed-off-by: Muthu Kumar <muthukumar@thefeathers.in>
pull/1/head
Muthu Kumar 2 years ago
parent
commit
ae28e389b1
Signed by: mkrhere GPG Key ID: 3FD688398897097E
  1. 25
      src/pages/blog/Home.tsx

25
src/pages/blog/Home.tsx

@ -97,7 +97,8 @@ const BlogHome: React.FC = () => {
} }
&:is(.article-open) { &:is(.article-open) {
aside { aside {
display: none; min-width: 0;
max-width: 0;
} }
main { main {
max-width: 0; max-width: 0;
@ -119,6 +120,7 @@ const BlogHome: React.FC = () => {
<button <button
onClick={() => setAsideClosed(closed => !closed)} onClick={() => setAsideClosed(closed => !closed)}
className={classNames( className={classNames(
"draw-ctl",
css` css`
border: none; border: none;
padding: 1rem; padding: 1rem;
@ -132,6 +134,7 @@ const BlogHome: React.FC = () => {
width: 100%; width: 100%;
height: 100%; height: 100%;
transition: transform 300ms; transition: transform 300ms;
z-index: 1000;
&:hover { &:hover {
background-color: #323232; background-color: #323232;
@ -162,7 +165,6 @@ const BlogHome: React.FC = () => {
width: 100%; width: 100%;
flex: 2; flex: 2;
max-width: 45rem; max-width: 45rem;
margin-inline-start: 3.6rem;
`}> `}>
<div <div
className={css` className={css`
@ -228,7 +230,7 @@ const BlogHome: React.FC = () => {
height: 100%; height: 100%;
width: 100%; width: 100%;
flex: 3; flex: 3;
z-index: 1000; z-index: 900;
display: flex; display: flex;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
@ -247,17 +249,11 @@ const BlogHome: React.FC = () => {
position: absolute; position: absolute;
transition: all 300ms; transition: all 300ms;
transform: translateX(100%); transform: translateX(100%);
@media screen and (max-width: 50rem) {
padding-block-start: 4rem;
padding-block-end: 6rem;
}
`, `,
{ isArticleOpen &&
[css` css`
transform: translateX(0%); transform: translateX(0%);
`]: isArticleOpen, `,
},
)}> )}>
<div <div
className={css` className={css`
@ -269,6 +265,11 @@ const BlogHome: React.FC = () => {
flex-direction: column; flex-direction: column;
padding: 8vw; padding: 8vw;
gap: 1.5rem; gap: 1.5rem;
@media screen and (max-width: 50rem) {
padding-block-start: 4rem;
padding-block-end: 6rem;
}
`}> `}>
{isArticleOpen && <BlogPost />} {isArticleOpen && <BlogPost />}
</div> </div>

Loading…
Cancel
Save