Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,190 --> 00:00:08,240
Now that we are able to validate the inputs that our user is providing to the text fields on the Contact
2
00:00:08,300 --> 00:00:15,680
Us page will now want to go ahead and display a prompt to the user to make sure that they confirm that
3
00:00:15,680 --> 00:00:22,930
that information is correct before it goes and gets sent off to me to show this little confirmation
4
00:00:22,930 --> 00:00:23,650
window.
5
00:00:23,650 --> 00:00:32,700
We're going to be using the material UI dialog component let's head over to the material UI documentation
6
00:00:32,700 --> 00:00:42,110
page and we'll take a look at all of the options that it provides for us for setting up these dialogs.
7
00:00:42,150 --> 00:00:50,560
I'm here at material dash UI dot com and I'm under components feedback and dialogues.
8
00:00:50,700 --> 00:00:57,490
And it repeats the a dialogue is a type of modal they asks the user to make a decision.
9
00:00:57,510 --> 00:01:03,480
And in this case we want to ask them to confirm that the information that they have provided is correct
10
00:01:04,850 --> 00:01:08,620
if we scroll down we'll see an example of a simple dialog.
11
00:01:08,630 --> 00:01:16,280
And so once you press this button it will open up and this right here is a dialog so you can see how
12
00:01:16,280 --> 00:01:18,830
the back of the screen went gray.
13
00:01:18,830 --> 00:01:23,660
It is opaque and that forces the focus onto the dialog itself.
14
00:01:23,660 --> 00:01:28,940
Making me understand that I have to make a choice before I can return back to what I was doing.
15
00:01:30,270 --> 00:01:36,070
You'll see it actually says here the mechanics of this is choosing an option will automatically permit
16
00:01:36,090 --> 00:01:38,210
the option and close the menu.
17
00:01:38,220 --> 00:01:43,860
So if I go ahead and select one of these accounts closes it or if I have this open and I click anywhere
18
00:01:43,890 --> 00:01:48,600
outside of the dialog that goes ahead and closes it out as well.
19
00:01:49,470 --> 00:01:56,010
The main things to know about the dialogue component are the props open which toggles whether or not
20
00:01:56,010 --> 00:02:03,140
the dialog is visible similar to our draw that we'd set up in the header and also similar to the draw.
21
00:02:03,240 --> 00:02:09,390
We have it on close function and that will make sure that we're toggling the visibility of that open
22
00:02:09,510 --> 00:02:17,580
state value well scroll down and here they give an example of an alert and this can be a dialogue with
23
00:02:17,580 --> 00:02:22,760
a little bit more functionality or content so you can see when I go ahead and open this up.
24
00:02:22,770 --> 00:02:28,390
We have here a title along with our text giving us a description of what's going on.
25
00:02:28,530 --> 00:02:34,830
And then we have two buttons to either accept or cancel the current operation if we go ahead and show
26
00:02:34,830 --> 00:02:36,140
the source for this.
27
00:02:36,150 --> 00:02:43,890
You can see that they are actually using a dialog dialog actions dialog content dialog content text
28
00:02:44,100 --> 00:02:46,560
and dialogue title components.
29
00:02:46,560 --> 00:02:53,250
And this is all putting together the very nicely styled dialogue that we see here following the material
30
00:02:53,250 --> 00:02:57,720
design specification the material UI is based on AI.
31
00:02:57,780 --> 00:03:02,360
However I do a lot of custom stuff and kind of stray away from this.
32
00:03:02,400 --> 00:03:07,470
And so we won't be using all of these different components in what I'm doing but they are good to be
33
00:03:07,470 --> 00:03:08,040
aware of.
34
00:03:08,040 --> 00:03:14,850
If you want to create these very nice clean looking standard dialogues but we can scroll down and see
35
00:03:15,110 --> 00:03:21,990
if they have the outer dialogue component wrapping all of the inner dialogue components similar to the
36
00:03:21,990 --> 00:03:23,410
structure we're used to.
37
00:03:23,520 --> 00:03:31,830
And on the dialogue component it has the open state the on close function and then inside we have the
38
00:03:31,830 --> 00:03:40,670
dialogue title a dialogue content and wrapped inside of that is the dialogue content text adjacent to
39
00:03:40,670 --> 00:03:49,280
our dialogue content we have the actions and that is where the buttons for r agree and disagree are
40
00:03:49,280 --> 00:03:50,120
coming from.
41
00:03:50,120 --> 00:03:54,400
These are the dialogue actions all right.
42
00:03:54,430 --> 00:03:55,870
So close out of that.
43
00:03:56,120 --> 00:03:57,400
We'll keep coming down.
44
00:03:57,400 --> 00:04:00,890
And here it shows how you can use different transitions.
45
00:04:00,910 --> 00:04:07,360
So this example uses these slide transitions that show the source first and you can see they're actually
46
00:04:07,360 --> 00:04:14,910
using a transition component provided to us by material UI that we will get into later actually.
47
00:04:15,010 --> 00:04:21,130
And then they are passing in that component to the transition component prop on the dialogue.
48
00:04:21,160 --> 00:04:26,410
So it's a little bit of a more advanced setup that will probably cover a little bit later but you can
49
00:04:26,410 --> 00:04:32,890
see when I click on this that slides up from the bottom different than previously where it just kind
50
00:04:32,890 --> 00:04:35,950
of appears from the middle.
51
00:04:35,950 --> 00:04:41,350
Now this example here I was just clicking is actually closer to something that we'll be doing because
52
00:04:41,380 --> 00:04:49,090
this has a form field built right into it a text input and it just shows the capability they will be
53
00:04:49,090 --> 00:04:54,820
taking advantage of when we put the confirmation for our form in a dialogue.
54
00:04:54,820 --> 00:05:01,150
So this shows here how we can customize the dialogue especially using the overrides but we're going
55
00:05:01,150 --> 00:05:05,980
to be fully customizing the dialogue so we won't really need to go into that.
56
00:05:06,160 --> 00:05:12,760
Still is pretty standard here but then below it shows us how we can use full screen dialogues and that
57
00:05:12,760 --> 00:05:19,420
almost creates an interesting kind of mobile user interface feel and could potentially be used for different
58
00:05:19,420 --> 00:05:22,360
settings or something like that within a mobile app.
59
00:05:22,690 --> 00:05:27,720
But then here it also shows how we can have a dialogue with a max width.
60
00:05:27,880 --> 00:05:35,080
So if we change the max width here it's not doing anything until we turn on the full width value and
61
00:05:35,080 --> 00:05:45,830
that tells it to take up about full width so here for extra small small medium large and extra large.
62
00:05:45,850 --> 00:05:51,440
But if we turn off that full width then it will only take up the bare minimum space available to it.
63
00:05:51,490 --> 00:05:57,790
But with the full with you can then set the max width to make sure it doesn't take up too much space
64
00:05:59,350 --> 00:06:01,180
so we can close out of that.
65
00:06:01,300 --> 00:06:08,170
And this shows how you can actually use a media query with the breakpoint system to determine whether
66
00:06:08,170 --> 00:06:10,180
or not these screens should be full or not.
67
00:06:10,210 --> 00:06:18,100
So here it's going to be not full screen but if we were to go ahead and if I shrink this page down and
68
00:06:18,340 --> 00:06:26,770
scroll back down to our responsive full screen and let's go and shrink this down to a nice small nice
69
00:06:26,830 --> 00:06:31,250
small screen size and now I go and I open this up you see that.
70
00:06:31,240 --> 00:06:37,420
Now that takes up the entire screen has completely different look and feel for our mobile devices.
71
00:06:37,480 --> 00:06:40,750
So that could look good in a lot of situations.
72
00:06:40,780 --> 00:06:48,520
I'll go ahead actually maximise this again and if we scroll underneath here this is an example of how
73
00:06:48,520 --> 00:06:52,390
you can make sure that a user has to select an option.
74
00:06:52,390 --> 00:06:59,530
So here even if I'm selecting an option it doesn't automatically clear out the dialog until I explicitly
75
00:06:59,530 --> 00:07:03,820
pick one and then select OK to mark that I am finished.
76
00:07:03,820 --> 00:07:10,150
So they call this a confirmation dialog because you have to confirm by pressing OK that you're finished
77
00:07:10,150 --> 00:07:17,530
working and then they give an example using a third party library to create a Dragonball dialog.
78
00:07:17,590 --> 00:07:19,040
So that looks pretty cool.
79
00:07:19,040 --> 00:07:20,110
Looks pretty nice.
80
00:07:20,950 --> 00:07:28,270
And then they show lastly how to set the scroll so we can open this up and let's see if we come down
81
00:07:28,270 --> 00:07:29,180
here.
82
00:07:29,200 --> 00:07:37,450
The scroll is set to the scroll value and the default is paper but they have a function and that function
83
00:07:37,450 --> 00:07:44,590
is set up to handle either of these scroll values but the scroll value itself is either being set to
84
00:07:44,620 --> 00:07:47,530
either paper or body.
85
00:07:47,740 --> 00:07:54,790
So you can see if you use a scroll prop equal to paper on your dialogue then that scrolls the paper
86
00:07:54,790 --> 00:08:02,200
component and keeps all of your content within the dialog where if you have the scroll of body it actually
87
00:08:02,200 --> 00:08:10,030
makes the dialog itself scroll the entire length of the content instead of fitting the content inside
88
00:08:10,030 --> 00:08:10,810
of it.
89
00:08:10,810 --> 00:08:13,120
So that should give you a good example.
90
00:08:13,120 --> 00:08:18,670
The two different scrolling options that you have with the dialogue but our content won't be long enough
91
00:08:18,670 --> 00:08:20,170
to worry about that.
92
00:08:20,200 --> 00:08:22,620
So it's just something to be aware of.
93
00:08:23,730 --> 00:08:28,950
All we really need to worry about for the dialogues that we're going to be using is just like this simple
94
00:08:28,950 --> 00:08:33,520
one is we're going to have an open value in an on closed function.
95
00:08:33,600 --> 00:08:39,930
And then once our dialogue is up on the screen all we'll be doing is putting in the content necessary
96
00:08:39,930 --> 00:08:44,690
to confirm the message and allow the user to change any of the inputs.
97
00:08:44,700 --> 00:08:46,290
If they do need changing.
98
00:08:46,290 --> 00:08:50,190
So let's go ahead and we'll start setting this up in the next video.
11223
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.