-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary edit button accessibility (#926)
* Solved tab accessibility * Added onclick * fixed cypress test --------- Co-authored-by: lassopicasso <[email protected]>
- Loading branch information
1 parent
cc2724d
commit 0d13eb1
Showing
4 changed files
with
53 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,23 @@ | ||
import * as React from 'react'; | ||
|
||
import { IconButton, makeStyles, Typography } from '@material-ui/core'; | ||
import { Button, ButtonColor, ButtonVariant } from '@digdir/design-system-react'; | ||
import { Edit } from '@navikt/ds-icons'; | ||
|
||
export interface IEditButtonProps { | ||
onClick: () => void; | ||
editText: string | null; | ||
} | ||
|
||
const useStyles = makeStyles({ | ||
editButton: { | ||
color: 'black', | ||
padding: 0, | ||
}, | ||
editIcon: { | ||
paddingLeft: '6px', | ||
fontSize: '1.125rem !important', | ||
}, | ||
change: { | ||
fontSize: '1.125rem', | ||
cursor: 'pointer', | ||
}, | ||
}); | ||
|
||
export function EditButton(props: IEditButtonProps) { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<IconButton | ||
<Button | ||
variant={ButtonVariant.Quiet} | ||
color={ButtonColor.Secondary} | ||
icon={<Edit aria-hidden={true} />} | ||
iconPlacement='right' | ||
onClick={props.onClick} | ||
className={classes.editButton} | ||
> | ||
<Typography | ||
variant='body1' | ||
className={classes.change} | ||
> | ||
<span>{props.editText}</span> | ||
<i | ||
aria-hidden='true' | ||
className={`fa fa-editing-file ${classes.editIcon}`} | ||
/> | ||
</Typography> | ||
</IconButton> | ||
{props.editText} | ||
</Button> | ||
); | ||
} |
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
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