## Description - Enabled the rule `@typescript-eslint/no-explicit-any` - Suppressed errors with comment ``` // TODO: Fix this the next time the file is edited // eslint-disable-next-line @typescript-eslint/no-explicit-any ``` Fixes #35308 ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10181176984> > Commit: 7fc604e24fa234da7ab2ff56e0b1c715268796ee > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10181176984&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Wed, 31 Jul 2024 15:00:45 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No
74 lines
1.9 KiB
TypeScript
74 lines
1.9 KiB
TypeScript
import { Flex, Icon, Text } from "design-system";
|
|
import React from "react";
|
|
import styled from "styled-components";
|
|
|
|
interface HeaderEditorSwitcherProps {
|
|
prefix: string;
|
|
title?: string;
|
|
titleTestId: string;
|
|
active: boolean;
|
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
className?: string;
|
|
}
|
|
|
|
const SwitchTrigger = styled.div<{ active: boolean }>`
|
|
border-radius: var(--ads-v2-border-radius);
|
|
background-color: ${(props) =>
|
|
props.active ? `var(--ads-v2-color-bg-subtle)` : "unset"};
|
|
cursor: pointer;
|
|
padding: var(--ads-v2-spaces-2);
|
|
:hover {
|
|
background-color: var(--ads-v2-color-bg-subtle);
|
|
}
|
|
`;
|
|
|
|
const HeaderEditorSwitcher = React.forwardRef(
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
(props: HeaderEditorSwitcherProps, ref: any) => {
|
|
const { active, className, prefix, title, titleTestId, ...rest } = props;
|
|
|
|
const separator = title ? " /" : "";
|
|
|
|
return (
|
|
<SwitchTrigger
|
|
active={active}
|
|
className={`flex align-center items-center justify-center ${className}`}
|
|
ref={ref}
|
|
{...rest}
|
|
>
|
|
<Text
|
|
color="var(--ads-v2-colors-content-label-inactive-fg)"
|
|
kind="body-m"
|
|
>
|
|
{prefix + separator}
|
|
</Text>
|
|
<Flex
|
|
alignItems="center"
|
|
className={titleTestId}
|
|
data-active={active}
|
|
gap="spaces-1"
|
|
height="100%"
|
|
justifyContent="center"
|
|
paddingLeft="spaces-2"
|
|
>
|
|
<Text isBold kind="body-m">
|
|
{title}
|
|
</Text>
|
|
<Icon
|
|
color={
|
|
title
|
|
? undefined
|
|
: "var(--ads-v2-colors-content-label-inactive-fg)"
|
|
}
|
|
name={active ? "arrow-up-s-line" : "arrow-down-s-line"}
|
|
size="md"
|
|
/>
|
|
</Flex>
|
|
</SwitchTrigger>
|
|
);
|
|
},
|
|
);
|
|
|
|
export default HeaderEditorSwitcher;
|