-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #564 from open-formulieren/feature/462-refactor-bu…
…tton [#462] Refactor button
- Loading branch information
Showing
36 changed files
with
361 additions
and
605 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
Submodule design-tokens
updated
7 files
+3 −0 | .gitignore | |
+2 −2 | package-lock.json | |
+1 −1 | package.json | |
+1 −1 | src/common/typography.tokens.json | |
+8 −1 | src/community/utrecht/action.tokens.json | |
+80 −7 | src/community/utrecht/button.tokens.json | |
+42 −0 | src/components/editgrid.tokens.json |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
import {Button as UtrechtButton} from '@utrecht/component-library-react'; | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
// Temporary until the aria-disabled is set on the Utrecht button | ||
const OFButton = ({disabled, children, ...extraProps}) => { | ||
const {onClick: onClickHandler, ...otherProps} = extraProps; | ||
|
||
if (disabled) otherProps.className = 'utrecht-button--disabled'; | ||
|
||
const onClick = event => { | ||
if (disabled) event.preventDefault(); | ||
|
||
if (onClickHandler) onClickHandler(event); | ||
}; | ||
|
||
return ( | ||
<UtrechtButton aria-disabled={disabled} onClick={onClick} {...otherProps}> | ||
{children} | ||
</UtrechtButton> | ||
); | ||
}; | ||
|
||
OFButton.propTypes = { | ||
disabled: PropTypes.bool, | ||
children: PropTypes.node, | ||
}; | ||
|
||
export default OFButton; |
Oops, something went wrong.