-
Notifications
You must be signed in to change notification settings - Fork 2.9k
ComponentPage: Add Edit On GitHub buttons to page sections #4424
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
Conversation
| } | ||
| return ( | ||
| <TooltipHost | ||
| content={ `Edit ${this.props.componentName} ${readableSection} on GitHub` } |
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.
@betrue-final-final I am not sure how accessible this new button is. Is the tooltip with this generated content good enough?
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.
@betrue-final-final Just a friendly bump. I'll have Kirk Myhre take a look at this design-wise too.
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.
@betrue-final-final Are you just worried about the color of the pencil or the addition of the icon and its place in the tab order/narrator in general?
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 actually didn't look yet, but now that I am, I do have some.
- The "View on Github" appearing as a pivot here is a usability issue actually. It looks like a pivot, but it's actually a link. That will affect everyone.
- Is it necessary to be able to edit all those things separately? Do we need that, or just enable editing the whole page?
Let's answer these questions and then evaluate the resulting design for accessibility.
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.
Good comment on the "View on Github" link placement. We'll have to figure out a better place for that within the content of the page.
Each one of those content "chunks" will be editable individually. Based on the way Markdown works and the way we're crafting the community editing experience, we want to provide a quick, easy way for folks to update only the bits that they're responsible for without affecting any others. make sense?
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.
- It doesn't have to appear there, or even at all, but I thought it might be convenient.
- It is necessary since they are each individual files and have to be that way to reduce non-dev confusion. If we are to implement more than three sections down the road it will be confusing to those not familiar with the component what file to edit if we link to just the /docs folder.
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.
Ok cool. However you might consider "Do's" and "Don'ts" as a single unit. I don't think one person will be assigned to "Do's" and another "Don'ts".
What color are the pencils?
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.
Right, ok that might be tricky on dos and don'ts. Just trying to simplify.
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.
Peter and I thought about how to combine Do's and Don'ts into one file. It'd require some sort of trigger in the markdown file for the markdown-to-jsx component to find and split into the required sections. It'd be too easy to break.
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.
@betrue-final-final The color of the pencils was palette.neutralSecondary but I'm thinking about removing any of the styles and just using IconButton's default styles.
|
That makes sense. Use components here. |
|
@kirkmyhre Do you have any suggestions on where to place the "View on GitHub" button, or not have it at all? My plan was for it to link to the component root in the repo ie: https://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-react/src/components/ActivityItem |
|
I'll leave this button off this PR, and we can come back to add it in later if we feel it'll be helpful in the future. It sounds like the edit buttons are good to go through, so if I can get approval for those today it'd unblock me converting the rest of the docs over. |
|
@betrue-final-final Thoughts on approving? Kirk doesn't have permissions to do so. |
|
Let me take a look. |
|
I ran the project, but I'm not seeing the changes. I may not have admin permissions to edit the sections. Maybe I can just take a look over your shoulder. |
|
This only enables the sections to be enabled if they have markdown, that'll come after this is merged since that conversion relies on the APIs I enabled here. |
|
Feel free to come by my desk to see how it works. |
| } | ||
| } | ||
|
|
||
| .ComponentPage-doSectionHr { |
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.
Can you expand 'Hr' into 'Header' or what ever it's for?
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.
It's for the <hr> tag that used to be the :after on the header since it now has to be inside a container for the edit button.
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.
Ah, makes sense now! Maybe another word then? Like 'line' or something? In case it ends up not being an hr tag someday.
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.
Good suggestion
| } | ||
|
|
||
| export enum ComponentPageSection { | ||
| Dos = 0, |
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.
Should we start these out alphabetized?
lynamemi
left a comment
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.
Left a couple of nit comments, but looks good, these are exciting changes!
|
@mikewheaton @lynamemi Looking the upcoming Fabric site changes, do you think it'd be worthwhile to split this edit button into its own functional component for use elsewhere? |
|
@jordandrako I like that idea! It definitely has its own thing going on. |
Enable them on ActivityItemPage.
Pull request checklist
$ npm run changeDescription of changes
New ComponentPage APIs:
componentUrlEnables the 'View On GitHub' button and programmatically enables the 'Edit' (pencil) buttons. The edit buttons use the URL given, then adds "/docs/${ComponentName}${section}.md" so it points to the relavant markdown file.editBestPracticesUrlEnables just the edit button for the Best Practices section. Overrides the URL fromcomponentUrl.editOverviewUrlEnables just the edit button for the Overview section. Overrides the URL fromcomponentUrl.editDosUrlEnables just the edit button for the Dos section. Overrides the URL fromcomponentUrl.editDontsUrlEnables just the edit button for the Don'ts section. Overrides the URL fromcomponentUrl.If only
componentUrlis used, the edit buttons are generated from that, the component's name, and the section name. It will not render an edit button if the section doesn't use a React Component, likePageMarkdown, so using HTML like adivwon't make an edit button appear in places you can't edit.All new buttons:
Edit buttons on hover show generated tooltip:
Focus areas to test
Ensure edit buttons are a11y compliant.