-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Introduce docs button #1743
Changes from 4 commits
07beb98
f8e2b7a
07202ee
ef446d9
8861c02
c7a82c5
ea6ab90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
|
||
import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons'; | ||
import { | ||
FontAwesomeIcon | ||
} from '@fortawesome/react-fontawesome'; | ||
|
||
import SimpleButton, { SimpleButtonProps } from '@terrestris/react-geo/dist/Button/SimpleButton/SimpleButton'; | ||
|
||
export type DocumentationButtonProps = SimpleButtonProps; | ||
|
||
const defaultClassName = 'documentationbutton'; | ||
export const DocumentationButton: React.FC<DocumentationButtonProps> = ({ | ||
className | ||
}) => { | ||
|
||
const finalClassName = className | ||
? `${defaultClassName} ${className}` | ||
: defaultClassName; | ||
|
||
return ( | ||
<SimpleButton | ||
onClick={() => window.open('/gis-docs', '_blank')} | ||
className={finalClassName} | ||
icon={ | ||
<FontAwesomeIcon | ||
icon={faCircleQuestion} | ||
/> | ||
} | ||
> | ||
</SimpleButton> | ||
); | ||
}; | ||
|
||
export default DocumentationButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import React from 'react'; | ||
|
||
import ClientConfiguration from 'clientConfig'; | ||
|
||
import DocumentationButton from '../../components/DocumentationButton'; | ||
import { | ||
useAppSelector | ||
} from '../../hooks/useAppSelector'; | ||
|
@@ -97,6 +100,25 @@ export const Header: React.FC<HeaderProps> = ({ | |
|
||
return items; | ||
}; | ||
const getDocsButton = () => { | ||
const items = [ | ||
<div | ||
key="documentation-button" | ||
aria-label="documentation-button" | ||
> | ||
<DocumentationButton | ||
key="documentation-button" | ||
type="link" | ||
> | ||
</DocumentationButton> | ||
|
||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need a wrapping There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. other components used a wrapping |
||
]; | ||
insertPlugins('right', items); | ||
if (ClientConfiguration.documentationButtonVisible) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd move the check to the top of the function:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check c7a82c5 |
||
return items; | ||
} | ||
}; | ||
|
||
return ( | ||
<div | ||
|
@@ -120,6 +142,9 @@ export const Header: React.FC<HeaderProps> = ({ | |
<div | ||
className="item-container right-items" | ||
> | ||
{ | ||
getDocsButton() | ||
} | ||
{ | ||
getRightItems() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The URL should be configurable, I guess.