chore: small cleanup

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-09-05 16:42:35 +02:00
parent 0d91710f44
commit cfeaec21f9
4 changed files with 30 additions and 37 deletions
+10 -16
View File
@@ -403,28 +403,22 @@ export type ErrorPanelProps = {
};
// @public
export function FavoriteToggle({
id,
title,
isFavorite: value,
onToggle: onChange,
...iconButtonProps
}: FavoriteToggleProps): React_2.JSX.Element;
export function FavoriteToggle(
props: ComponentProps<typeof IconButton> & {
id: string;
title: string;
isFavorite: boolean;
onToggle: (value: boolean) => void;
},
): React_2.JSX.Element;
// @public
export function FavoriteToggleIcon({
isFavorite,
}: {
export function FavoriteToggleIcon(props: {
isFavorite: boolean;
}): React_2.JSX.Element;
// @public (undocumented)
export type FavoriteToggleProps = ComponentProps<typeof IconButton> & {
id: string;
title: string;
isFavorite: boolean;
onToggle: (value: boolean) => void;
};
export type FavoriteToggleIconClassKey = 'icon' | 'iconBorder';
// @public (undocumented)
export type FeatureCalloutCircleClassKey =
@@ -14,14 +14,14 @@
* limitations under the License.
*/
import { render } from '@testing-library/react';
import { FavoriteToggle, FavoriteToggleProps } from './FavoriteToggle';
import { FavoriteToggle } from './FavoriteToggle';
import React from 'react';
import userEvent from '@testing-library/user-event';
describe('<FavoriteToggle />', () => {
const onToggle = jest.fn();
const props: FavoriteToggleProps = {
const props = {
title: 'Favorite this thing',
id: 'some-thing-favorite',
onToggle,
@@ -39,16 +39,6 @@ const useStyles = makeStyles<Theme>(
*/
export type FavoriteToggleIconClassKey = 'icon' | 'iconBorder';
/**
* @public
*/
export type FavoriteToggleProps = ComponentProps<typeof IconButton> & {
id: string;
title: string;
isFavorite: boolean;
onToggle: (value: boolean) => void;
};
/**
* Icon used in FavoriteToggle component.
*
@@ -56,7 +46,8 @@ export type FavoriteToggleProps = ComponentProps<typeof IconButton> & {
*
* @public
*/
export function FavoriteToggleIcon({ isFavorite }: { isFavorite: boolean }) {
export function FavoriteToggleIcon(props: { isFavorite: boolean }) {
const { isFavorite } = props;
const classes = useStyles();
return isFavorite ? (
@@ -74,13 +65,21 @@ export function FavoriteToggleIcon({ isFavorite }: { isFavorite: boolean }) {
*
* @public
*/
export function FavoriteToggle({
id,
title,
isFavorite: value,
onToggle: onChange,
...iconButtonProps
}: FavoriteToggleProps) {
export function FavoriteToggle(
props: ComponentProps<typeof IconButton> & {
id: string;
title: string;
isFavorite: boolean;
onToggle: (value: boolean) => void;
},
) {
const {
id,
title,
isFavorite: value,
onToggle: onChange,
...iconButtonProps
} = props;
return (
<Tooltip id={id} title={title}>
<IconButton
@@ -15,4 +15,4 @@
*/
export { FavoriteToggle, FavoriteToggleIcon } from './FavoriteToggle';
export type { FavoriteToggleProps } from './FavoriteToggle';
export type { FavoriteToggleIconClassKey } from './FavoriteToggle';