You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then add the following line to the <i>head</i> tag in the <i>public/index.html</i> file. The line loads Google's font Roboto.
@@ -261,7 +261,7 @@ Now let's use MaterialUI to do the same modifications to the code we did earlier
261
261
Render the contents of the whole application within a [Container](https://material-ui.com/components/container/):
262
262
263
263
```js
264
-
importContainerfrom'@material-ui/core/Container'
264
+
import{ Container} from'@mui/material'
265
265
266
266
constApp= () => {
267
267
// ...
@@ -359,12 +359,11 @@ The end result is:
359
359
360
360
MaterialUI, unlike Bootstrap, does not provide a component for the form itself. The form here is an ordinary HTML [form](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) element.
361
361
362
-
<!-- Lomakkeen käyttämät komponentit on luonnollisesti importattava koodissa. -->
363
362
Remember to import all the components used in the form.
364
363
365
364
#### Notification
366
365
367
-
The notification displayed on login can be done using the [Alert](https://material-ui.com/components/alert/) component, which is quite similiar to bootstrap's equivalent component:
366
+
The notification displayed on login can be done using the [Alert](https://material-ui.com/components/alert/) component, which is quite similiar to Bootstrap's equivalent component:
368
367
369
368
```js
370
369
<div>
@@ -378,18 +377,6 @@ The notification displayed on login can be done using the [Alert](https://materi
378
377
</div>
379
378
```
380
379
381
-
The Alert component is not yet included in the MaterialUI core package, so we have to install the [lab](https://material-ui.com/components/about-the-lab/) package to use it:
Copy file name to clipboardExpand all lines: src/content/7/fi/osa7c.md
+5-17Lines changed: 5 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,9 @@ Monesta UI-frameworkista on tehty React-ystävällisiä versiota, joissa UI-fram
21
21
22
22
Katsotaan seuraavaksi kahta UI-frameworkia bootstrapia ja [MaterialUI](https://material-ui.com/):ta. Lisätään molempien avulla samantapaiset tyylit luvun [React Router](/osa7/react_router) sovellukseen.
23
23
24
-
### react bootstrap
24
+
### React Bootstrap
25
25
26
-
Aloitetaan bootstrapista, käytetään kirjastoa [react-bootstrap](https://react-bootstrap.github.io/).
26
+
Aloitetaan Bootstrapista, käytetään kirjastoa [react-bootstrap](https://react-bootstrap.github.io/).
27
27
28
28
Asennetaan kirjasto suorittamalla komento
29
29
@@ -259,7 +259,7 @@ Tehdään nyt MaterialUI:n avulla koodiin suunnilleen samat muutokset, mitä tei
259
259
Renderöidään koko sovelluksen sisältö komponentin [Container](https://material-ui.com/components/container/) sisälle:
Alert-komponentti ei ole vielä mukana MaterialUI:n core-pakkauksessa, ja komponentin sisältävä pakkaus [lab](https://material-ui.com/components/about-the-lab/) tulee asentaa sovellukseen:
379
-
380
-
```bash
381
-
npm install @material-ui/lab
382
-
```
383
-
384
-
Komponentti importataan seuraavasti
385
-
386
-
```js
387
-
import { Alert } from'@mui/material'
388
-
```
389
-
390
378
Alert on ulkoasultaan tyylikäs:
391
379
392
380

@@ -469,13 +457,13 @@ Esimerkin sovelluksen koodi kokonaisuudessaan [täällä](https://github.com/ful
469
457
470
458
### Loppuhuomioita
471
459
472
-
Ero react-bootstrapin ja MaterialUI:n välillä ei ole suuri. On makuasia kummalla tuotettu ulkoasu on tyylikkäämpi. En ole itse käyttänyt MaterialUI:ta kovin paljoa, mutta ensikosketus on positiivinen. Dokumentaatio vaikuttaa aavistuksen react-bootstrapin dokumentaatiota selkeämmältä. Eri npm-kirjastojen lautausmääriä vertailevan sivuston https://www.npmtrends.com/ mukaan MaterialUI ohitti react-boostrapin suosiossa vuoden 2018 loppupuolella ja on kasvattanut sen jälkeen eroa tasaisesti:
460
+
Ero React Bootstrapin ja MaterialUI:n välillä ei ole suuri. On makuasia kummalla tuotettu ulkoasu on tyylikkäämpi. En ole itse käyttänyt MaterialUI:ta kovin paljoa, mutta ensikosketus on positiivinen. Dokumentaatio vaikuttaa aavistuksen react-bootstrapin dokumentaatiota selkeämmältä. Eri npm-kirjastojen lautausmääriä vertailevan sivuston https://www.npmtrends.com/ mukaan MaterialUI ohitti react-boostrapin suosiossa vuoden 2018 loppupuolella ja on kasvattanut sen jälkeen eroa tasaisesti:
473
461
474
462

475
463
476
464
Esimerkeissä käytettiin UI-frameworkeja niiden React-integraatiot tarjoavien kirjastojen kautta.
477
465
478
-
Sen sijaan että käytämme kirjastoa [react bootstrap](https://react-bootstrap.github.io/), olisimme voineet aivan yhtä hyvin käyttää [Bootstrapia](https://getbootstrap.com/) suoraan, liittämällä HTML-elementteihin CSS-luokkia. Eli sen sijaan että määrittelimme esim. taulukon komponentin <i>Table</i> avulla
466
+
Sen sijaan että käytämme kirjastoa [React Bootstrap](https://react-bootstrap.github.io/), olisimme voineet aivan yhtä hyvin käyttää [Bootstrapia](https://getbootstrap.com/) suoraan, liittämällä HTML-elementteihin CSS-luokkia. Eli sen sijaan että määrittelimme esim. taulukon komponentin <i>Table</i> avulla
0 commit comments