Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SPP 2143 Learning Through Connecting
ltc_website
Commits
a359c128
Commit
a359c128
authored
Feb 12, 2020
by
Elisabeth Reuhl
Browse files
Fixed stuff missing from PageHeader component from previous commit
parent
f0e2faa8
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/components/OurFirstComponentWithAllRelatedFiles/.keep
deleted
100644 → 0
View file @
f0e2faa8
src/components/OurFirstComponentWithAllRelatedFiles/Headings.jsx
deleted
100644 → 0
View file @
f0e2faa8
import
React
from
'
react
'
;
// the hook
import
{
useTranslation
}
from
'
react-i18next
'
;
export
const
Headings
=
()
=>
{
const
{
t
,
i18n
}
=
useTranslation
();
return
([
<
h1
>
{
t
(
'
EntangledAfrica1
'
)
}
</
h1
>,
<
h2
>
{
t
(
'
EntangledAfrica2
'
)
}
</
h2
>
])
};
\ No newline at end of file
src/components/PageHeader/PageHeader.jsx
View file @
a359c128
...
...
@@ -3,6 +3,11 @@ import { useTranslation } from 'react-i18next';
export
const
PageHeader
=
()
=>
{
const
{
t
,
i18n
}
=
useTranslation
();
const
changeLanguage
=
lng
=>
{
i18n
.
changeLanguage
(
lng
);
};
return
(
<
header
>
<
div
>
...
...
src/components/index.js
View file @
a359c128
...
...
@@ -2,4 +2,4 @@
//by doing this all components can be imported from './components/';
//named exports are used instead of default export; thus imports need to be destructured
export
{
HelloComputerButton
}
from
'
./HelloComputerButton/HelloComputerButton
'
;
export
{
Headings
}
from
'
./OurFirstComponentWithAllRelatedFiles/Headings
'
;
\ No newline at end of file
export
{
PageHeader
}
from
'
./PageHeader/PageHeader
'
;
\ No newline at end of file
src/index.js
View file @
a359c128
import
React
,
{
useState
,
useContext
}
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
{
HelloComputerButton
}
from
'
./components/
'
;
import
{
Headings
}
from
'
./components/
'
;
import
{
PageHeader
}
from
'
./components/
'
;
import
{
LabelsContext
,
SettingsContext
}
from
'
./Contexts
'
;
import
{
INIT_LABELS
,
INIT_SETTINGS
}
from
"
./INIT_VALUES
"
;
import
'
./index.css
'
;
...
...
@@ -12,10 +12,6 @@ const App = () => {
const
{
t
,
i18n
}
=
useTranslation
();
const
changeLanguage
=
lng
=>
{
i18n
.
changeLanguage
(
lng
);
};
const
[
labels
,
setLabels
]
=
useState
(
INIT_LABELS
);
const
[
settings
,
setSettings
]
=
useState
(
INIT_SETTINGS
);
...
...
@@ -36,11 +32,7 @@ const App = () => {
return
(
<
LabelsContext
.
Provider
value
=
{
labels
}
><
SettingsContext
.
Provider
value
=
{
settings
}
>
<
button
onClick
=
{()
=>
changeLanguage
(
'
de
'
)}
>
Deutsch
<
/button
>
<
button
onClick
=
{()
=>
changeLanguage
(
'
en
'
)}
>
English
<
/button
>
<
button
onClick
=
{()
=>
changeLanguage
(
'
fr
'
)}
>
Français
<
/button
>
<
button
onClick
=
{()
=>
changeLanguage
(
'
ar
'
)}
>
لعربية
<
/button
>
<
Headings
/>
<
PageHeader
/>
<
div
>
<
span
>
{
labels
.
HelloWorld
[
settings
.
language
]}
<
/span><br /
>
<
HelloComputerButton
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment