rusackas commented on a change in pull request #10298:
URL:
https://github.com/apache/incubator-superset/pull/10298#discussion_r454534085
##########
File path: superset-frontend/src/components/Menu/SubMenu.tsx
##########
@@ -63,70 +52,63 @@ const StyledHeader = styled.header`
}
`;
-interface SubMenuProps {
- canCreate?: boolean;
- childs?: Array<{ label: string; name: string; url: string }>;
- createButton?: { name: string; url: string | null };
- fetchData?: () => void;
+type MenuChild = {
+ label: string;
name: string;
-}
-
-const SubMenu = ({
- canCreate,
- childs,
- createButton,
- fetchData,
- name,
-}: SubMenuProps) => {
- const [isModalOpen, setIsModalOpen] = useState(false);
- const [selectedMenu, setSelectedMenu] = useState<string | undefined>(
- childs?.[0]?.label,
- );
-
- const onOpen = () => {
- setIsModalOpen(true);
- };
+ url: string;
+};
- const onClose = () => {
- setIsModalOpen(false);
+export interface SubMenuProps {
+ primaryButton?: {
+ name: React.ReactNode;
+ onClick: OnClickHandler;
};
-
- const handleClick = (item: string) => () => {
- setSelectedMenu(item);
+ secondaryButton?: {
+ name: React.ReactNode;
+ onClick: OnClickHandler;
};
+ name: string;
+ children?: MenuChild[];
+ activeChild?: MenuChild['name'];
+}
+const SubMenu: React.FunctionComponent<SubMenuProps> = props => {
return (
<StyledHeader>
<Navbar inverse fluid role="navigation">
<Navbar.Header>
- <Navbar.Brand>{name}</Navbar.Brand>
+ <Navbar.Brand>{props.name}</Navbar.Brand>
</Navbar.Header>
- <DatasetModal
- fetchData={fetchData}
- onHide={onClose}
- show={isModalOpen}
- />
<Nav>
- {childs &&
- childs.map(child => (
+ {props.children &&
Review comment:
👏 that name always rubbed me the wrong way ;)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]