Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
digibib
deichman
Commits
35e6c085
Commit
35e6c085
authored
Mar 10, 2021
by
David Björkheim
Browse files
DEICH-5591
Deichman.no: rename callback for LoginButton
parent
51ca7fbb
Changes
2
Hide whitespace changes
Inline
Side-by-side
deichman.no/components/LoginButton/LoginButton.js
View file @
35e6c085
...
...
@@ -7,11 +7,11 @@ import ModalPortal from "../ModalPortal/ModalPortal";
export
default
function
LoginButton
(
props
)
{
const
children
=
props
.
children
;
const
on
Click
=
props
.
on
Click
||
Function
.
prototype
;
const
on
ShowModal
=
props
.
on
ShowModal
||
Function
.
prototype
;
const
butttonsProps
=
{
...
props
};
delete
butttonsProps
.
children
;
delete
butttonsProps
.
on
Click
;
delete
butttonsProps
.
on
ShowModal
;
const
[
showLoginModal
,
setShowLoginModal
]
=
useState
(
false
);
const
[
showDelayedModal
,
setShowDelayedModal
]
=
useState
(
false
);
...
...
@@ -22,6 +22,10 @@ export default function LoginButton(props) {
},
[
showLoginModal
]
);
const
clickHandler
=
()
=>
{
setShowLoginModal
(
true
);
onShowModal
();
};
return
(
<>
{
showLoginModal
&&
(
...
...
@@ -53,13 +57,7 @@ export default function LoginButton(props) {
<
/FocusTrap
>
<
/ModalPortal
>
)}
<
Button
{...
butttonsProps
}
onClick
=
{()
=>
{
setShowLoginModal
(
true
);
onClick
();
}}
>
<
Button
{...
butttonsProps
}
onClick
=
{
clickHandler
}
>
{
children
}
<
/Button
>
<
/
>
...
...
deichman.no/components/ReservePublicationWidget/ReservePublicationWidget.js
View file @
35e6c085
...
...
@@ -180,7 +180,7 @@ export default function ReservePublicationWidget({
<
h3
>
{
title
}
<
/h3
>
{
!
isLoggedIn
&&
(
<
div
>
<
LoginButton
on
Click
=
{
trackLogin
}
primary
>
<
LoginButton
on
ShowModal
=
{
trackLogin
}
primary
>
Logg
inn
og
bestill
<
/LoginButton
>
<
/div
>
...
...
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