Skip to content
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

471 - add official link icon #514

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions frontend/src/screens/RouteScreen.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ const useStyles = makeStyles(theme => ({
},
breadCrumbsWrapper: {
padding: '1%',
paddingRight: '0',
display: 'flex',
justifyContent: 'space-between',
Comment on lines +37 to +38
Copy link
Author

Choose a reason for hiding this comment

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

This looks a little weird on mobile
image

I think solving it could be as simple as adding a media query that sets flexDirection: column for mobile sizes, but I'm not sure how to do media queries within Material UI 😅 The strategy I found in their docs seems complicated, which makes me think I might be looking at the wrong approach

Copy link
Member

Choose a reason for hiding this comment

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

Nah, don't overcomplicate it.

The more elegant solution, to me, is to make that text label only visible on medium and large screens (you can do that with tools from here, i think) and replace it with a small icon on small screens.

},
externalLink: {
color: 'rgba(0, 0, 0, 0.54)',
},
officialLink: {
display: 'flex',
alignItems: 'center',
},
}));

Expand Down Expand Up @@ -140,7 +148,14 @@ function RouteScreen(props) {
: null;

const classes = useStyles();
const { breadCrumbStyling, breadCrumbsWrapper } = classes;
const {
breadCrumbStyling,
breadCrumbsWrapper,
externalLink,
officialLink,
} = classes;
const officialInfoUrl = selectedRoute && selectedRoute.url;

return (
<Fragment>
<AppBar position="relative">
Expand Down Expand Up @@ -184,6 +199,18 @@ function RouteScreen(props) {
classes,
)}
</Breadcrumbs>
{officialInfoUrl && (
<div className={officialLink}>
<a
href={officialInfoUrl}
target="_blank"
rel="noopener noreferrer"
className={externalLink}
>
Official Site
</a>
</div>
)}
</Paper>
<Grid container spacing={0}>
<Grid item xs={12} sm={6}>
Expand Down Expand Up @@ -225,7 +252,4 @@ const mapDispatchToProps = dispatch => ({
fetchRoutes: params => dispatch(fetchRoutes(params)),
});

export default connect(
mapStateToProps,
mapDispatchToProps,
)(RouteScreen);
export default connect(mapStateToProps, mapDispatchToProps)(RouteScreen);