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

adding share button to share route info to different social media platforms #570

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

ckrajewski
Copy link
Contributor

Fixes #517

Proposed changes

Add a share button using Material UI to show a drop down of platforms to share routes to

Screenshot

image

@ckrajewski
Copy link
Contributor Author

Need feedback on button color - should not be blue obviously

@hathix
Copy link
Member

hathix commented Feb 20, 2020

It would be nice to have something like the "English" button on the Material UI website (white with no background and a caret pointing down):

Screen Shot 2020-02-19 at 9 23 20 PM

@hathix
Copy link
Member

hathix commented Feb 20, 2020

@akgupta89
Copy link
Member

I'd suggest using the typical share icons instead of the word "share"

https://material-ui.com/components/material-icons/

Copy link
Member

@hathix hathix left a comment

Choose a reason for hiding this comment

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

So to recap:

  • Use the share icon from here
  • Use the white link with no background color (not a button; see my earlier post)
  • Have your dropdown use other icons from here (like for twitter, etc.)

Screen Shot 2020-02-26 at 6 51 08 PM

@ckrajewski
Copy link
Contributor Author

ckrajewski commented Mar 5, 2020

Feel free to take a look at PR
Currently looking ar using Material UI icons instead on the ones provided from https://www.npmjs.com/package/react-share
Though I am getting an error when trying to import Material UI icons

image

Comment on lines +30 to +41
<Menu
elevation={0}
getContentAnchorEl={null}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
{...props}
Copy link
Member

Choose a reason for hiding this comment

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

I think it looks a bit weird for the menu to pop down from the center of the share button. It would be better if the share button and the share menu were left-aligned.

Copy link
Member

Choose a reason for hiding this comment

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

I would still suggest this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It loads from the right hand side now
Since it's right aligned to the page
image

Comment on lines +57 to +82
const shareComponents = {
twitter: TwitterShareButton,
reddit: RedditShareButton,
facebook: FacebookShareButton,
};
const iconComponents = {
twitter: TwitterIcon,
reddit: RedditIcon,
facebook: FacebookIcon,
};
const dropDownItems = [
{
shareComponent: shareComponents.twitter,
icon: iconComponents.twitter,
label: 'Twitter',
},
{
shareComponent: shareComponents.reddit,
icon: iconComponents.reddit,
label: 'Reddit',
},
{
shareComponent: shareComponents.facebook,
icon: iconComponents.facebook,
label: 'Facebook',
},
Copy link
Member

Choose a reason for hiding this comment

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

I might get rid of the shareComponents and iconComponents objects and just reference the TwitterShareButton, TwitterIcon, etc. in the dropDownItems directly. That makes it easier to add new sharing buttons later.

@hathix
Copy link
Member

hathix commented Apr 16, 2020

Chris, it looks like you might have to change some code now that the UI has been changed a lot. The share button will probably have to go in the white bar on the route screen:

image

@hathix
Copy link
Member

hathix commented Apr 23, 2020

note from our call: put the share button in the white header bar on the routes page (to the right of the date/time/route selectors). It doesn't make sense to add the share button to the header bar, because it doesn't make sense adding it to the blue bar (since that would imply that sharing is available on the entire app... and it makes less sense on the about page or the homepage).

@hathix hathix self-requested a review May 28, 2020 01:09
@hathix
Copy link
Member

hathix commented May 28, 2020

I'll review this.

Copy link
Member

@hathix hathix left a comment

Choose a reason for hiding this comment

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

Unfortunately the share button doesn't work with the latest UI changes. I can click it, but it doesn't do anything. Can you check and update it?

Also, the share button looks misaligned:

image

const classes = useStyles();
const { flex } = classes;
const url = window.location.href;
const theme = createMuiTheme({
Copy link
Member

Choose a reason for hiding this comment

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

Nice use of the theme here.

Comment on lines 238 to 248
{selectedDirection ? (
<>
<FormControl className={classes.formControl}>
<ReactSelect
onChange={onSelectFirstStop}
inputId="fromstop"
textFieldProps={{
label: (
<span style={labelStyle}>
Origin Stop{' '}
{graphParams.startStopId ? (
Copy link
Member

Choose a reason for hiding this comment

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

Did you change this, or was this imported from master?

Comment on lines +30 to +41
<Menu
elevation={0}
getContentAnchorEl={null}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'center',
}}
transformOrigin={{
vertical: 'top',
horizontal: 'center',
}}
{...props}
Copy link
Member

Choose a reason for hiding this comment

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

I would still suggest this change.


const StyledMenu = withStyles({
paper: {
border: '1px solid #d3d4d5',
Copy link
Member

Choose a reason for hiding this comment

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

Can you get a color from the MuiTheme provider here instead of hardcoding one?

<span style={labelStyle}>
Direction{' '}
{graphParams.directionId ? (
<div className={classes.shareContainer}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

changes are due to whitespace from me adding CSS to include the Share drop down now
Added div with styling (shareContainer class)

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.

Add share buttons to pages with information on them
3 participants