-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[docs] Improve the demos copy experience #19291
[docs] Improve the demos copy experience #19291
Conversation
Details of bundle changes.Comparing: d30e6bb...efd72a9
|
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.
You can make "view on GitHub" a menu item, and put copy in its place.
Got it! I’m away from my computer right now but I will make the changes
later today.
…On Sun, Jan 19, 2020 at 12:19 PM Matt ***@***.***> wrote:
***@***.**** requested changes on this pull request.
You can make "view on GitHub" a menu item, and put copy in its place.
------------------------------
In docs/src/modules/components/Demo.js
<#19291 (comment)>:
> @@ -225,6 +241,8 @@ function Demo(props) {
const handleClickCopy = async () => {
try {
await copy(demoData.raw);
+ setSnackBarMessage('The code has been copied!');
Could you add the strings to the English version of the translations
somewhere in this part of the file:
https://github.com/mui-org/material-ui/blob/master/docs/translations/translations.json#L69
(The rest of the files will be handled by Crowdin).
(Pedantic aside: I don't think we need the "!", it isn't that exciting. 🙂
)
------------------------------
In docs/src/modules/components/Demo.js
<#19291 (comment)>:
> @@ -168,6 +170,20 @@ function Demo(props) {
setDemoHovered(event.type === 'mouseenter');
};
+ const [SnackbarOpen, setSnackbarOpen] = React.useState(false);
+ const [SnackBarMessage, setSnackBarMessage] = React.useState(undefined);
+
+ const Alert = SnackBarProps => {
+ return <MuiAlert elevation={6} variant="filled" {...SnackBarProps} />;
So long as Material-UI remains "Material Design first", I think we should
stick to the non-customized Snackbar.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#19291>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJEI4PXETSNEPU45XQQ2JYLQ6SYT7ANCNFSM4KIWMVHA>
.
|
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.
What about we swap the position of the GitHub and Copy links in this pull request? #19099
@@ -17,7 +17,7 @@ const useStyles = makeStyles((theme: Theme) => | |||
}), | |||
); | |||
|
|||
export default function ActionAlerts() { | |||
export default function TransitionAlerts() { |
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.
Unrelated change
Now when the transition alert is open, it offers to close it, and when it is closed it offers to re-open it.
yarn prettier
Snackbar is now fully finished! When someone copies text it willl show them a snackbar to let them know it has been copied!
Got rid of bad code
4937dac
to
7a50c48
Compare
fd51f03
to
7a50c48
Compare
7a50c48
to
efd72a9
Compare
@theswerd Thank you for leading this effort 👌 |
Resolves #19112
This pr makes a Snackbar show whenever a use copies code or links to the code.
Edit @eps1lon:
Preview