Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Greenlight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arbeitsgruppe Hardwarenahe IT-Systeme
Greenlight
Commits
31e17681
Unverified
Commit
31e17681
authored
2 years ago
by
Samuel Couillard
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix AuthButtons for mobile (#4653)
* Fix AuthButtons for mobile * esf
parent
bea8dc73
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/javascript/components/home/AuthButtons.jsx
+16
-5
16 additions, 5 deletions
app/javascript/components/home/AuthButtons.jsx
app/javascript/components/home/NavbarNotSignedIn.jsx
+1
-10
1 addition, 10 deletions
app/javascript/components/home/NavbarNotSignedIn.jsx
with
17 additions
and
15 deletions
app/javascript/components/home/AuthButtons.jsx
+
16
−
5
View file @
31e17681
...
@@ -3,11 +3,12 @@ import { Form, Stack } from 'react-bootstrap';
...
@@ -3,11 +3,12 @@ import { Form, Stack } from 'react-bootstrap';
import
Button
from
'
react-bootstrap/Button
'
;
import
Button
from
'
react-bootstrap/Button
'
;
import
{
useLocation
,
useSearchParams
}
from
'
react-router-dom
'
;
import
{
useLocation
,
useSearchParams
}
from
'
react-router-dom
'
;
import
{
useTranslation
}
from
'
react-i18next
'
;
import
{
useTranslation
}
from
'
react-i18next
'
;
import
PropTypes
from
'
prop-types
'
;
import
ButtonLink
from
'
../shared_components/utilities/ButtonLink
'
;
import
ButtonLink
from
'
../shared_components/utilities/ButtonLink
'
;
import
useSiteSetting
from
'
../../hooks/queries/site_settings/useSiteSetting
'
;
import
useSiteSetting
from
'
../../hooks/queries/site_settings/useSiteSetting
'
;
import
useEnv
from
'
../../hooks/queries/env/useEnv
'
;
import
useEnv
from
'
../../hooks/queries/env/useEnv
'
;
export
default
function
AuthButtons
()
{
export
default
function
AuthButtons
(
{
direction
}
)
{
const
{
data
:
env
}
=
useEnv
();
const
{
data
:
env
}
=
useEnv
();
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
{
search
}
=
useLocation
();
const
{
search
}
=
useLocation
();
...
@@ -27,17 +28,19 @@ export default function AuthButtons() {
...
@@ -27,17 +28,19 @@ export default function AuthButtons() {
return
(
return
(
<
Form
action
=
"/auth/openid_connect"
method
=
"POST"
data-turbo
=
"false"
>
<
Form
action
=
"/auth/openid_connect"
method
=
"POST"
data-turbo
=
"false"
>
<
input
type
=
"hidden"
name
=
"authenticity_token"
value
=
{
document
.
querySelector
(
'
meta[name="csrf-token"]
'
).
content
}
/>
<
input
type
=
"hidden"
name
=
"authenticity_token"
value
=
{
document
.
querySelector
(
'
meta[name="csrf-token"]
'
).
content
}
/>
<
Button
variant
=
"brand-outline-color"
className
=
"btn m-2"
type
=
"submit"
>
{
t
(
'
authentication.sign_up
'
)
}
</
Button
>
<
Stack
direction
=
{
direction
}
gap
=
{
2
}
>
<
Button
variant
=
"brand"
className
=
"btn m-2"
type
=
"submit"
>
{
t
(
'
authentication.sign_in
'
)
}
</
Button
>
<
Button
variant
=
"brand-outline-color"
className
=
"btn"
type
=
"submit"
>
{
t
(
'
authentication.sign_up
'
)
}
</
Button
>
<
Button
variant
=
"brand"
className
=
"btn"
type
=
"submit"
>
{
t
(
'
authentication.sign_in
'
)
}
</
Button
>
</
Stack
>
</
Form
>
</
Form
>
);
);
}
}
return
(
return
(
<
Stack
direction
=
"horizontal"
>
<
Stack
direction
=
{
direction
}
gap
=
{
2
}
>
{
showSignUp
()
{
showSignUp
()
&&
(
&&
(
<
ButtonLink
to
=
{
`/signup
${
search
}
`
}
variant
=
"brand-outline-color"
className
=
"btn
me-2
"
>
<
ButtonLink
to
=
{
`/signup
${
search
}
`
}
variant
=
"brand-outline-color"
className
=
"btn"
>
{
t
(
'
authentication.sign_up
'
)
}
{
t
(
'
authentication.sign_up
'
)
}
</
ButtonLink
>
</
ButtonLink
>
)
}
)
}
...
@@ -45,3 +48,11 @@ export default function AuthButtons() {
...
@@ -45,3 +48,11 @@ export default function AuthButtons() {
</
Stack
>
</
Stack
>
);
);
}
}
AuthButtons
.
defaultProps
=
{
direction
:
'
horizontal
'
,
};
AuthButtons
.
propTypes
=
{
direction
:
PropTypes
.
oneOf
([
'
horizontal
'
,
'
vertical
'
]),
};
This diff is collapsed.
Click to expand it.
app/javascript/components/home/NavbarNotSignedIn.jsx
+
1
−
10
View file @
31e17681
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Nav
,
Navbar
}
from
'
react-bootstrap
'
;
import
{
Nav
,
Navbar
}
from
'
react-bootstrap
'
;
import
{
Link
}
from
'
react-router-dom
'
;
import
{
useTranslation
}
from
'
react-i18next
'
;
import
AuthButtons
from
'
./AuthButtons
'
;
import
AuthButtons
from
'
./AuthButtons
'
;
export
default
function
NavbarNotSignedIn
()
{
export
default
function
NavbarNotSignedIn
()
{
const
{
t
}
=
useTranslation
();
return
(
return
(
<>
<>
<
Navbar
.
Toggle
aria-controls
=
"responsive-navbar-nav"
className
=
"border-0"
/>
<
Navbar
.
Toggle
aria-controls
=
"responsive-navbar-nav"
className
=
"border-0"
/>
...
@@ -14,12 +10,7 @@ export default function NavbarNotSignedIn() {
...
@@ -14,12 +10,7 @@ export default function NavbarNotSignedIn() {
{
/* Hidden Mobile */
}
{
/* Hidden Mobile */
}
<
Navbar
.
Collapse
id
=
"navbar-menu"
className
=
"bg-white w-100 position-absolute"
>
<
Navbar
.
Collapse
id
=
"navbar-menu"
className
=
"bg-white w-100 position-absolute"
>
<
Nav
className
=
"d-block d-sm-none text-black px-2"
>
<
Nav
className
=
"d-block d-sm-none text-black px-2"
>
<
Nav
.
Link
eventKey
=
{
1
}
as
=
{
Link
}
to
=
"/signin"
>
<
AuthButtons
direction
=
"vertical"
/>
{
t
(
'
authentication.sign_in
'
)
}
</
Nav
.
Link
>
<
Nav
.
Link
eventKey
=
{
2
}
as
=
{
Link
}
to
=
"/signup"
>
{
t
(
'
authentication.sign_up
'
)
}
</
Nav
.
Link
>
</
Nav
>
</
Nav
>
</
Navbar
.
Collapse
>
</
Navbar
.
Collapse
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment