Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -34,7 +34,7 @@ const StyledHoverableMenuItemBase = styled(StyledMenuItemBase)`
|
||||
}
|
||||
`;
|
||||
|
||||
export function MenuItem({
|
||||
export const MenuItem = ({
|
||||
LeftIcon,
|
||||
accent = 'default',
|
||||
text,
|
||||
@ -42,7 +42,7 @@ export function MenuItem({
|
||||
className,
|
||||
testId,
|
||||
onClick,
|
||||
}: MenuItemProps) {
|
||||
}: MenuItemProps) => {
|
||||
const showIconButtons = Array.isArray(iconButtons) && iconButtons.length > 0;
|
||||
|
||||
return (
|
||||
@ -60,4 +60,4 @@ export function MenuItem({
|
||||
</div>
|
||||
</StyledHoverableMenuItemBase>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -44,13 +44,13 @@ export type MenuItemProps = {
|
||||
onClick?: () => void;
|
||||
};
|
||||
|
||||
export function MenuItemCommand({
|
||||
export const MenuItemCommand = ({
|
||||
LeftIcon,
|
||||
text,
|
||||
command,
|
||||
className,
|
||||
onClick,
|
||||
}: MenuItemProps) {
|
||||
}: MenuItemProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
@ -68,4 +68,4 @@ export function MenuItemCommand({
|
||||
<StyledCommandText>{command}</StyledCommandText>
|
||||
</StyledMenuItemCommandContainer>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -21,16 +21,16 @@ type OwnProps = {
|
||||
onSelectChange?: (selected: boolean) => void;
|
||||
};
|
||||
|
||||
export function MenuItemMultiSelect({
|
||||
export const MenuItemMultiSelect = ({
|
||||
LeftIcon,
|
||||
text,
|
||||
selected,
|
||||
className,
|
||||
onSelectChange,
|
||||
}: OwnProps) {
|
||||
function handleOnClick() {
|
||||
}: OwnProps) => {
|
||||
const handleOnClick = () => {
|
||||
onSelectChange?.(!selected);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledMenuItemBase className={className} onClick={handleOnClick}>
|
||||
@ -40,4 +40,4 @@ export function MenuItemMultiSelect({
|
||||
</StyledLeftContentWithCheckboxContainer>
|
||||
</StyledMenuItemBase>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -24,16 +24,16 @@ type OwnProps = {
|
||||
onSelectChange?: (selected: boolean) => void;
|
||||
};
|
||||
|
||||
export function MenuItemMultiSelectAvatar({
|
||||
export const MenuItemMultiSelectAvatar = ({
|
||||
avatar,
|
||||
text,
|
||||
selected,
|
||||
className,
|
||||
onSelectChange,
|
||||
}: OwnProps) {
|
||||
function handleOnClick() {
|
||||
}: OwnProps) => {
|
||||
const handleOnClick = () => {
|
||||
onSelectChange?.(!selected);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledMenuItemBase className={className} onClick={handleOnClick}>
|
||||
@ -48,4 +48,4 @@ export function MenuItemMultiSelectAvatar({
|
||||
</StyledLeftContentWithCheckboxContainer>
|
||||
</StyledMenuItemBase>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -13,12 +13,12 @@ export type MenuItemProps = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export function MenuItemNavigate({
|
||||
export const MenuItemNavigate = ({
|
||||
LeftIcon,
|
||||
text,
|
||||
className,
|
||||
onClick,
|
||||
}: MenuItemProps) {
|
||||
}: MenuItemProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
@ -27,4 +27,4 @@ export function MenuItemNavigate({
|
||||
<IconChevronRight size={theme.icon.size.sm} />
|
||||
</StyledMenuItemBase>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -49,7 +49,7 @@ type OwnProps = {
|
||||
hovered?: boolean;
|
||||
};
|
||||
|
||||
export function MenuItemSelect({
|
||||
export const MenuItemSelect = ({
|
||||
LeftIcon,
|
||||
text,
|
||||
selected,
|
||||
@ -57,7 +57,7 @@ export function MenuItemSelect({
|
||||
onClick,
|
||||
disabled,
|
||||
hovered,
|
||||
}: OwnProps) {
|
||||
}: OwnProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
@ -72,4 +72,4 @@ export function MenuItemSelect({
|
||||
{selected && <IconCheck size={theme.icon.size.sm} />}
|
||||
</StyledMenuItemSelect>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -22,7 +22,7 @@ type OwnProps = {
|
||||
testId?: string;
|
||||
};
|
||||
|
||||
export function MenuItemSelectAvatar({
|
||||
export const MenuItemSelectAvatar = ({
|
||||
avatar,
|
||||
text,
|
||||
selected,
|
||||
@ -31,7 +31,7 @@ export function MenuItemSelectAvatar({
|
||||
disabled,
|
||||
hovered,
|
||||
testId,
|
||||
}: OwnProps) {
|
||||
}: OwnProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
@ -52,4 +52,4 @@ export function MenuItemSelectAvatar({
|
||||
{selected && <IconCheck size={theme.icon.size.sm} />}
|
||||
</StyledMenuItemSelect>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -30,7 +30,7 @@ type OwnProps = {
|
||||
color: ThemeColor;
|
||||
};
|
||||
|
||||
export function MenuItemSelectColor({
|
||||
export const MenuItemSelectColor = ({
|
||||
color,
|
||||
text,
|
||||
selected,
|
||||
@ -38,7 +38,7 @@ export function MenuItemSelectColor({
|
||||
onClick,
|
||||
disabled,
|
||||
hovered,
|
||||
}: OwnProps) {
|
||||
}: OwnProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
@ -56,4 +56,4 @@ export function MenuItemSelectColor({
|
||||
{selected && <IconCheck size={theme.icon.size.sm} />}
|
||||
</StyledMenuItemSelect>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -12,16 +12,16 @@ type OwnProps = {
|
||||
onToggleChange?: (toggled: boolean) => void;
|
||||
};
|
||||
|
||||
export function MenuItemToggle({
|
||||
export const MenuItemToggle = ({
|
||||
LeftIcon,
|
||||
text,
|
||||
toggled,
|
||||
className,
|
||||
onToggleChange,
|
||||
}: OwnProps) {
|
||||
function handleOnClick() {
|
||||
}: OwnProps) => {
|
||||
const handleOnClick = () => {
|
||||
onToggleChange?.(!toggled);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<StyledMenuItemBase className={className} onClick={handleOnClick}>
|
||||
@ -29,4 +29,4 @@ export function MenuItemToggle({
|
||||
<Toggle value={toggled} onChange={onToggleChange} />
|
||||
</StyledMenuItemBase>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -13,7 +13,7 @@ type OwnProps = {
|
||||
text: string;
|
||||
};
|
||||
|
||||
export function MenuItemLeftContent({ LeftIcon, text }: OwnProps) {
|
||||
export const MenuItemLeftContent = ({ LeftIcon, text }: OwnProps) => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
@ -26,4 +26,4 @@ export function MenuItemLeftContent({ LeftIcon, text }: OwnProps) {
|
||||
</StyledMenuItemLabel>
|
||||
</StyledMenuItemLeftContent>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user