-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding QR code with link to current page in the header drop-down.
- Loading branch information
1 parent
816efff
commit 21a9668
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/components/layout/HeaderQRCodeDropdown/HeaderQRCodeDropdown.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { Dropdown } from 'react-bootstrap'; | ||
import QRCode from 'react-qr-code'; | ||
|
||
import Icon from '../../icons'; | ||
|
||
const preventClickPropagation = ev => ev.stopPropagation(); | ||
|
||
const HeaderQRCodeDropdown = () => ( | ||
<Dropdown as="li" align="end" navbar className="nav-item" data-bs-theme="light"> | ||
<Dropdown.Toggle as="a" id="dropdown-qr-code-link" bsPrefix="nav-link"> | ||
<Icon icon="qrcode" /> | ||
</Dropdown.Toggle> | ||
|
||
<Dropdown.Menu rootCloseEvent="mousedown" onMouseDown={preventClickPropagation}> | ||
<Dropdown.Header> | ||
<FormattedMessage id="app.QRCodeDropdown.title" defaultMessage="QR code link to current page" /> | ||
</Dropdown.Header> | ||
|
||
<Dropdown.Divider className="mb-0" /> | ||
|
||
<div className="mx-5 my-4 text-center"> | ||
<QRCode size={256} value={window.location.href} /> | ||
</div> | ||
<p className="mx-3 small"> | ||
<code className="small">{window.location.href}</code> | ||
</p> | ||
</Dropdown.Menu> | ||
</Dropdown> | ||
); | ||
|
||
HeaderQRCodeDropdown.propTypes = {}; | ||
|
||
export default HeaderQRCodeDropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import HeaderQRCodeDropdown from './HeaderQRCodeDropdown.js'; | ||
export default HeaderQRCodeDropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters