mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
37b818fce4
* feat: new tags * feat: archive * wip: variants * add support for deletion, variable/fixed weight toggle and weight editing * Add confirmation dialogue for deleting variants * feat: settings * fix: recalculate on project name change * feat: feature environment metrics * feat: environment * Add toggle for stale * fix: refetch on create strategy * fix: lint * fix: update snapshots * fix: add link to icon button * fix: revert test user * fix: increase size! * fix: use permission attr for ResponsiveButton * fix: dev dependency * fix: theme * fix: stale style * Update src/component/feature/FeatureView2/FeatureSettings/FeatureSettingsMetadata/FeatureTypeSelect/FeatureTypeSelect.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/FeatureView2/FeatureVariants/FeatureVariantsList/FeatureVariantsList.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> * Update src/component/feature/FeatureView2/FeatureVariants/FeatureVariantsList/FeatureVariantsListItem/useDeleteVariantMarkup.tsx Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai> Co-authored-by: Christopher Kolstad <git@chriswk.no>
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import { useMediaQuery } from '@material-ui/core';
|
|
import ConditionallyRender from '../ConditionallyRender';
|
|
import PermissionButton from '../PermissionButton/PermissionButton';
|
|
import PermissionIconButton from '../PermissionIconButton/PermissionIconButton';
|
|
|
|
interface IResponsiveButtonProps {
|
|
Icon: React.ElementType;
|
|
onClick: () => void;
|
|
tooltip?: string;
|
|
disabled?: boolean;
|
|
permission?: string;
|
|
maxWidth: string;
|
|
}
|
|
|
|
const ResponsiveButton: React.FC<IResponsiveButtonProps> = ({
|
|
Icon,
|
|
onClick,
|
|
maxWidth,
|
|
tooltip,
|
|
disabled = false,
|
|
children,
|
|
permission,
|
|
...rest
|
|
}) => {
|
|
const smallScreen = useMediaQuery(`(max-width:${maxWidth})`);
|
|
|
|
return (
|
|
<ConditionallyRender
|
|
condition={smallScreen}
|
|
show={
|
|
<PermissionIconButton
|
|
disabled={disabled}
|
|
onClick={onClick}
|
|
permission={permission}
|
|
data-loading
|
|
{...rest}
|
|
>
|
|
<Icon />
|
|
</PermissionIconButton>
|
|
}
|
|
elseShow={
|
|
<PermissionButton
|
|
onClick={onClick}
|
|
permission={permission}
|
|
color="primary"
|
|
variant="contained"
|
|
disabled={disabled}
|
|
data-loading
|
|
{...rest}
|
|
>
|
|
{children}
|
|
</PermissionButton>
|
|
}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default ResponsiveButton;
|