Skip to content

Add Mobile And Table Screens#1562

Merged
bedeho merged 7 commits intoJoystream:init_atlasfrom
fcescob:responsive-screens
Nov 5, 2020
Merged

Add Mobile And Table Screens#1562
bedeho merged 7 commits intoJoystream:init_atlasfrom
fcescob:responsive-screens

Conversation

@fcescob
Copy link
Copy Markdown

@fcescob fcescob commented Oct 21, 2020

No description provided.

@fcescob fcescob requested a review from kdembler October 28, 2020 08:31
const Container = styled.div<GridProps>`
const toPx = (n: number | string) => (typeof n === 'number' ? `${n}px` : n)

const LARGE_VIEWPORT_BREAKPOINT = toPx(2000)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe let's move that to theme.breakpoints so we don't have a bunch of breakpoints scattered across the source files

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Idea, moved.

}
},
})
const isLargeViewport = useMediaQuery({ query: `(min-width: ${LARGE_VIEWPORT_BREAKPOINT})` })
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use a regular CSS media query here, without JS?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason it was not working properly when I tried, but now looks fine, so I removed this and went back to regular CSS.


export const CoverImage = styled.img<CoverImageProps>`
display: block;
position: absolute;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the image should be absolute here. What's stopping us from having it be a part of the layout?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm setting the image to be absolute because I'm using a "trick" to preserve the aspect ratio of the images.
I absolutely position each image in a div which has a width of 100% and a padding-top of 100% * aspectRatio, so the absolute positioning is required in this case.
I'm happy to change this if there is a better way though.

display: flex;
align-items: center;
padding-top: ${theme.sizes.b10}px;
@media (max-width: ${theme.breakpoints.mobile}) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we both made improvements to that view, that's probably my bad. I added a couple more things though I think so let's get this merged and I'll rebase

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave this as is then and I'll leave it up to you to rebase / add your changes on top.

export const Content = styled.div`
display: grid;
grid-template-columns: 650px 1fr;
grid-template-columns: minmax(50%, 650px) 1fr;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't related to this piece of code. But the best match video still suffers from the problem of changing the image aspect ratio when resizing. Also take a look at how it looks like at 500px, this needs improvement:

Screenshot 2020-10-28 at 12 43 39 PM

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't catch that, thanks. I've made some changes and now it should look better. The trick to preserve the aspect ratio I've described above is used here as well, again happy to chance if a better solution comes up.

grid-template-columns: min(650px, 50%) 1fr;
grid-column-gap: 24px;

@media (max-width: 750px) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that use one of the defined breakpoints?

small: '21rem',
medium: '48rem',
large: '72rem',
mobile: '480px',
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen you've renamed large, maybe we should rename the others as well at the same time?

@@ -1,5 +1,6 @@
import styled from '@emotion/styled'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relating to the styling since I can't comment the specific line:

Looks much better now, but I think we should also tweak the padding of InnerContainer once the title moves underneath the poster. Also the Container has right padding that doesn't seem to fit in mobile view. Take a look:

Screenshot 2020-10-30 at 12 53 48 PM

There is excess white space to the right and between the poster and the title

@kdembler kdembler mentioned this pull request Nov 3, 2020
Copy link
Copy Markdown
Collaborator

@kdembler kdembler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bedeho bedeho merged commit ebde24e into Joystream:init_atlas Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants