-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify studioToggleableTextfield some
- Loading branch information
Showing
43 changed files
with
402 additions
and
662 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
7 changes: 3 additions & 4 deletions
7
.../libs/studio-components/src/components/StudioIconTextfield/StudioIconTextfield.module.css
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
11 changes: 4 additions & 7 deletions
11
frontend/libs/studio-components/src/components/StudioIconTextfield/StudioIconTextfield.tsx
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
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
27 changes: 14 additions & 13 deletions
27
...ponents/StudioToggleableTextfield/StudioTextfieldToggleView/StudioTextfieldToggleView.tsx
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,36 +1,37 @@ | ||
import React from 'react'; | ||
import { PencilIcon, KeyVerticalIcon } from '@studio/icons'; | ||
import { PencilIcon } from '@studio/icons'; | ||
import { StudioButton, type StudioButtonProps } from '@studio/components'; | ||
import classes from './StudioTextfieldToggleView.module.css'; | ||
import cn from 'classnames'; | ||
|
||
export type StudioTextfieldToggleViewProps = StudioButtonProps & { | ||
export type StudioTextfieldToggleViewProps = Omit<StudioButtonProps, 'icon'> & { | ||
Icon?: React.ComponentType<React.SVGProps<SVGSVGElement>>; | ||
label?: string; | ||
}; | ||
|
||
export const StudioTextfieldToggleView = ({ | ||
onClick, | ||
children, | ||
title, | ||
label, | ||
className: givenClass, | ||
icon = <KeyVerticalIcon data-testid='keyIcon' aria-hidden />, | ||
Icon, | ||
...rest | ||
}: StudioTextfieldToggleViewProps) => { | ||
const className = cn(classes.button, givenClass); | ||
|
||
return ( | ||
<StudioButton className={className} onClick={onClick} {...rest}> | ||
<span className={classes.viewModeIconsContainer} title={title}> | ||
{icon} | ||
<StudioButton variant='tertiary' className={className} onClick={onClick} {...rest}> | ||
<span className={classes.viewModeIconsContainer}> | ||
<Icon aria-hidden /> | ||
<span className={classes.textContainer}> | ||
{label && <span className={classes.label}>{label}</span>} | ||
<span className={classes.ellipsis}>{children}</span> | ||
{label && ( | ||
<span className={classes.label} aria-hidden> | ||
{label} | ||
</span> | ||
)} | ||
<span className={classes.ellipsis}>{rest.value}</span> | ||
</span> | ||
</span> | ||
<span className={classes.editIconWrapper}> | ||
<PencilIcon className={classes.editIcon} data-testid='editIcon' aria-hidden /> | ||
</span> | ||
<PencilIcon className={classes.editIcon} aria-hidden /> | ||
</StudioButton> | ||
); | ||
}; |
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
Oops, something went wrong.