-
Notifications
You must be signed in to change notification settings - Fork 9
Make UI responsive #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make UI responsive #314
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,14 +62,14 @@ export const Banner = (props: IBannerProps) => { | |
const defaultTitleStyles = { | ||
fontSize: '20px', | ||
fontWeight: 'bold', | ||
marginBottom: '8px' | ||
marginBottom: '4px' | ||
}; | ||
const defaultTextStyles = { | ||
fontSize: '16px', | ||
marginBottom: '16px' | ||
marginBottom: '10px' | ||
}; | ||
const bannerButtons = { | ||
marginTop: '20px' | ||
marginTop: 'auto' | ||
}; | ||
const defaultButtonStyles: CSSProperties = { | ||
textAlign: 'left', | ||
|
@@ -82,71 +82,100 @@ export const Banner = (props: IBannerProps) => { | |
cursor: 'pointer' | ||
}; | ||
const defaultTextParentStyles = { | ||
flex: '1' | ||
flex: '1', | ||
maxWidth: 'calc(100% - 80px)' | ||
}; | ||
|
||
return ( | ||
<div | ||
className="banner" | ||
style={{ | ||
...defaultBannerStyles, | ||
...BannerStyle | ||
}} | ||
onClick={onClickView} | ||
> | ||
<> | ||
<style> | ||
{` | ||
@media screen and (max-width: 800px) { | ||
.titleText { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
max-height: 2.6em; | ||
line-height: 1.3em; | ||
} | ||
.banner { | ||
height: 250px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
} | ||
`} | ||
</style> | ||
<div | ||
className="banner" | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'row' | ||
...defaultBannerStyles, | ||
...BannerStyle | ||
}} | ||
onClick={onClickView} | ||
> | ||
<div style={defaultTextParentStyles}> | ||
<div style={{ overflowWrap: 'anywhere' }}> | ||
<text style={{ ...defaultTitleStyles, ...titleStyle }}> | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'row' | ||
}} | ||
> | ||
<div style={defaultTextParentStyles}> | ||
<text | ||
className="titleText" | ||
style={{ | ||
...defaultTitleStyles, | ||
...titleStyle, | ||
display: 'block' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. display: block should go into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
}} | ||
> | ||
{title} | ||
</text> | ||
<br></br> | ||
<text style={{ ...defaultTextStyles, ...textStyle }}>{text}</text> | ||
</div> | ||
<div style={bannerButtons}> | ||
{primaryBtnLabel ? ( | ||
<button | ||
disabled={disablePrimaryBtn} | ||
style={ | ||
disablePrimaryBtn | ||
? { | ||
...defaultButtonStyles, | ||
...primaryDisableBtnStyle | ||
} | ||
: { ...defaultButtonStyles, ...primaryBtnStyle } | ||
} | ||
onClick={onClickPrimaryBtn} | ||
> | ||
{primaryBtnLabel ? primaryBtnLabel : 'Button 1'} | ||
</button> | ||
) : null} | ||
{secondaryBtnLabel ? ( | ||
<button | ||
disabled={disableSecondaryBtn} | ||
style={ | ||
disableSecondaryBtn | ||
? { | ||
...defaultButtonStyles, | ||
...secondaryDisableBtnStyle | ||
} | ||
: { ...defaultButtonStyles, ...secondaryBtnStyle } | ||
} | ||
onClick={onClickSecondaryBtn} | ||
> | ||
{secondaryBtnLabel ? secondaryBtnLabel : 'Button 2'} | ||
</button> | ||
) : null} | ||
<text | ||
className="titleText" | ||
style={{ ...defaultTextStyles, ...textStyle, display: 'block' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
> | ||
{text} | ||
</text> | ||
</div> | ||
{imgSrc && ( | ||
<img style={{ ...defaultImageStyles, ...imgStyle }} src={imgSrc} /> | ||
)} | ||
</div> | ||
<div style={bannerButtons}> | ||
{primaryBtnLabel ? ( | ||
<button | ||
disabled={disablePrimaryBtn} | ||
style={ | ||
disablePrimaryBtn | ||
? { | ||
...defaultButtonStyles, | ||
...primaryDisableBtnStyle | ||
} | ||
: { ...defaultButtonStyles, ...primaryBtnStyle } | ||
} | ||
onClick={onClickPrimaryBtn} | ||
> | ||
{primaryBtnLabel ? primaryBtnLabel : 'Button 1'} | ||
</button> | ||
) : null} | ||
{secondaryBtnLabel ? ( | ||
<button | ||
disabled={disableSecondaryBtn} | ||
style={ | ||
disableSecondaryBtn | ||
? { | ||
...defaultButtonStyles, | ||
...secondaryDisableBtnStyle | ||
} | ||
: { ...defaultButtonStyles, ...secondaryBtnStyle } | ||
} | ||
onClick={onClickSecondaryBtn} | ||
> | ||
{secondaryBtnLabel ? secondaryBtnLabel : 'Button 2'} | ||
</button> | ||
) : null} | ||
</div> | ||
{imgSrc && ( | ||
<img style={{ ...defaultImageStyles, ...imgStyle }} src={imgSrc} /> | ||
)} | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,11 +63,11 @@ export const Card = (props: ICardProps) => { | |
const defaultTitleStyles = { | ||
fontSize: '18px', | ||
fontWeight: 'bold', | ||
marginBottom: '10px' | ||
marginBottom: '4px' | ||
}; | ||
const defaultTextStyles = { | ||
fontSize: '14px', | ||
marginBottom: '16px' | ||
marginBottom: '10px' | ||
}; | ||
const defaultButtonStyles: CSSProperties = { | ||
textAlign: 'left', | ||
|
@@ -87,59 +87,86 @@ export const Card = (props: ICardProps) => { | |
}; | ||
|
||
const cardButtons = { | ||
marginTop: '20px', | ||
marginTop: 'auto', | ||
marginLeft: '5px' | ||
}; | ||
|
||
return ( | ||
<div style={{ ...defaultCardStyles, ...cardStyle }} onClick={onClickView}> | ||
{imgSrc && ( | ||
<img style={{ ...defaultImageStyles, ...imgStyle }} src={imgSrc} /> | ||
)} | ||
<div style={{ ...defaultTextParentStyles }}> | ||
<text | ||
style={{ ...defaultTitleStyles, ...titleStyle, display: 'block' }} | ||
> | ||
{title} | ||
</text> | ||
<text style={{ ...defaultTextStyles, ...textStyle, display: 'block' }}> | ||
{text} | ||
</text> | ||
</div> | ||
<div style={cardButtons}> | ||
{primaryBtnLabel ? ( | ||
<button | ||
disabled={disablePrimaryBtn} | ||
style={ | ||
disablePrimaryBtn | ||
? { | ||
...defaultButtonStyles, | ||
...primaryDisableBtnStyle | ||
} | ||
: { ...defaultButtonStyles, ...primaryBtnStyle } | ||
<> | ||
<style> | ||
{` | ||
@media screen and (max-width: 800px) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. styles should be in a const There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
.titleText { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
max-height: 2.6em; | ||
line-height: 1.3em; | ||
} | ||
onClick={onClickPrimaryBtn} | ||
> | ||
{primaryBtnLabel ? primaryBtnLabel : 'Button 1'} | ||
</button> | ||
) : null} | ||
{secondaryBtnLabel ? ( | ||
<button | ||
disabled={disableSecondaryBtn} | ||
style={ | ||
disableSecondaryBtn | ||
? { | ||
...defaultButtonStyles, | ||
...secondaryDisableBtnStyle | ||
} | ||
: { ...defaultButtonStyles, ...secondaryBtnStyle } | ||
.card { | ||
height: 450px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
onClick={onClickSecondaryBtn} | ||
} | ||
`} | ||
</style> | ||
<div | ||
className="card" | ||
style={{ ...defaultCardStyles, ...cardStyle }} | ||
onClick={onClickView} | ||
> | ||
{imgSrc && ( | ||
<img style={{ ...defaultImageStyles, ...imgStyle }} src={imgSrc} /> | ||
)} | ||
<div style={{ ...defaultTextParentStyles }}> | ||
<text | ||
className="titleText" | ||
style={{ ...defaultTitleStyles, ...titleStyle, display: 'block' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. display: block again There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
> | ||
{title} | ||
</text> | ||
<text | ||
className="titleText" | ||
style={{ ...defaultTextStyles, ...textStyle, display: 'block' }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
> | ||
{secondaryBtnLabel ? secondaryBtnLabel : 'Button 2'} | ||
</button> | ||
) : null} | ||
{text} | ||
</text> | ||
</div> | ||
<div style={cardButtons}> | ||
{primaryBtnLabel ? ( | ||
<button | ||
disabled={disablePrimaryBtn} | ||
style={ | ||
disablePrimaryBtn | ||
? { | ||
...defaultButtonStyles, | ||
...primaryDisableBtnStyle | ||
} | ||
: { ...defaultButtonStyles, ...primaryBtnStyle } | ||
} | ||
onClick={onClickPrimaryBtn} | ||
> | ||
{primaryBtnLabel ? primaryBtnLabel : 'Button 1'} | ||
</button> | ||
) : null} | ||
{secondaryBtnLabel ? ( | ||
<button | ||
disabled={disableSecondaryBtn} | ||
style={ | ||
disableSecondaryBtn | ||
? { | ||
...defaultButtonStyles, | ||
...secondaryDisableBtnStyle | ||
} | ||
: { ...defaultButtonStyles, ...secondaryBtnStyle } | ||
} | ||
onClick={onClickSecondaryBtn} | ||
> | ||
{secondaryBtnLabel ? secondaryBtnLabel : 'Button 2'} | ||
</button> | ||
) : null} | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep our styles and our components separate. Please, at a minimum, pull this out into its own constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done