From 7d67c231d47972cfbfc1f1f6acade19bae852764 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Tue, 6 Aug 2019 08:34:18 -0500 Subject: [PATCH] refactor SubscribeButton dropdown --- .../modules/allListsTable/AllListsTable.tsx | 1 - .../src/shared/SubscribeButton.tsx | 35 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/FilterLists.Web.V2/src/modules/allListsTable/AllListsTable.tsx b/src/FilterLists.Web.V2/src/modules/allListsTable/AllListsTable.tsx index 10c704a47..537f05e91 100644 --- a/src/FilterLists.Web.V2/src/modules/allListsTable/AllListsTable.tsx +++ b/src/FilterLists.Web.V2/src/modules/allListsTable/AllListsTable.tsx @@ -40,7 +40,6 @@ export class AllListsTable extends React.Component<{}, State> { dataIndex={nameof("description")} /> title="Subscribe" dataIndex={nameof("viewUrl")} - width={100} fixed="right" render={(text: string, record: List, index: number) => } /> diff --git a/src/FilterLists.Web.V2/src/shared/SubscribeButton.tsx b/src/FilterLists.Web.V2/src/shared/SubscribeButton.tsx index f95f19546..d55ed6b4b 100644 --- a/src/FilterLists.Web.V2/src/shared/SubscribeButton.tsx +++ b/src/FilterLists.Web.V2/src/shared/SubscribeButton.tsx @@ -1,7 +1,11 @@ -import { Button, Dropdown, Icon, Menu } from 'antd'; +import { Button, Dropdown, Menu } from 'antd'; import { ButtonProps, ButtonType } from "antd/lib/button"; import * as React from "react"; +//TODO: import DropdownButtonType from antd rather than redefining if they export the type +//import { DropdownButtonType } from "antd/lib/dropdown"; +declare type DropdownButtonType = 'primary' | 'ghost' | 'dashed'; + interface Props { name: string; viewUrl: string; @@ -12,23 +16,26 @@ export const SubscribeButton = (props: Props): JSX.Element | null => (props.viewUrlMirrors && props.viewUrlMirrors.length > 0) ? : props.viewUrl - ? + ? : null; -const SubscribeButtonDropdown = (props: Props): JSX.Element => - - {props.viewUrlMirrors.map( - (viewUrlMirror: string, i: number) => +const SubscribeButtonDropdown = (props: Props): JSX.Element => { + var buttonProps = buildButtonProps(props.name, props.viewUrl); + //TODO: pass title (ref https://github.com/ant-design/ant-design/issues/18122) + return + {props.viewUrlMirrors.map((viewUrlMirror: string, i: number) => - + )} - - }> - - ; + + }> + Subscribe + ; +}; const buildButtonProps = (name: string, viewUrl: string): ButtonProps => { let type: ButtonType = "primary";