Skip to content

Commit

Permalink
feat(mobile-stories): add mobile compatibility (#487)
Browse files Browse the repository at this point in the history
* feat(mobile-stories): add mobile compatibility

* refactor(mobile-stories): remove true from property

* fix(mobile-stories): fix selector for right side component

* refactor(mobile): change flex basis
  • Loading branch information
KatvonRivia committed Aug 19, 2020
1 parent 0bae587 commit 3e12e69
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/scripts/components/main/button/button.styl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@

svg
fill: $textDefault

@media screen and (max-width: 480px)
.hideLabel
span
display: none
4 changes: 3 additions & 1 deletion src/scripts/components/main/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface Props {
link?: string;
disabled?: boolean;
className?: string;
hideLabelOnMobile?: boolean;
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
}

Expand All @@ -20,13 +21,14 @@ const Button: FunctionComponent<Props> = ({
icon: Icon,
disabled = false,
className = '',
hideLabelOnMobile,
onClick
}) => {
const classes = cx(
styles.button,
className,
disabled && styles.disabled,
disabled && className
hideLabelOnMobile && styles.hideLabel
);

return link ? (
Expand Down
6 changes: 6 additions & 0 deletions src/scripts/components/stories/header/header.styl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
white-space: nowrap
font-size: emCalc(18px)

@media screen and (max-width: 480px)
.title
flex-basis: 400px
overflow: hidden
text-overflow: ellipsis

.rightContent
display: flex
flex-grow: 1
Expand Down
1 change: 1 addition & 0 deletions src/scripts/components/stories/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const Header: FunctionComponent<Props> = ({
icon={ArrowBackIcon}
label={backButtonId}
link={backLink}
hideLabelOnMobile
/>
{!isSplashScreen && <h1 className={styles.title}>{title}</h1>}
<div className={styles.rightContent}>{children}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@

p
line-height: emCalc(22px)

@media screen and (max-width: 480px)
.content
padding: emCalc(20px)
width: 80%
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const SplashScreen: FunctionComponent<Props> = ({storyId, slide}) => {
className={styles.splashscreen}
style={{
background: `center / cover no-repeat url(${imageUrl}) rgba(0, 0, 0, 0.3)`,
width: '100%'
width: '100%',
height: '100%'
}}>
<div className={styles.content}>
<ReactMarkdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@

p
margin: emCalc(10px) 0

@media screen and (max-width: 480px)
.content
order: 2
overflow-y: unset
padding-top: 0
width: 100%
5 changes: 5 additions & 0 deletions src/scripts/components/stories/story-media/story-media.styl
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,8 @@
width: 100%
height: 100%
object-fit: contain

@media screen and (max-width: 480px)
.storyMedia
order: 1
padding: 0
16 changes: 16 additions & 0 deletions src/scripts/components/stories/story/story.styl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,24 @@
flex-grow: 1
width: 50%

.rightSideComponent
height: 100%

.globeContainer
position: relative
display: flex
flex-direction: column
height: 100%

@media screen and (max-width: 480px)
.main
display: flex
flex-direction: column
overflow-y: auto

> :last-child
height: 300px

> *
padding: 25px
width: inherit

0 comments on commit 3e12e69

Please sign in to comment.