Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import * as React from "react"; import { Loader, Box, Button, Flex } from "rimble-ui"; import styled from "styled-components"; import { baseColors, colors } from "../../themes/colors"; const StyledOutlineButton = styled(Button.Outline)` svg { width: 18px; height: 18px; } `; const HalfButton: React.FunctionComponent<any> = (props) => ( <StyledOutlineButton {...props} mainColor={baseColors.black} style={{ ...props.style }} size="small" /> ); export interface SplitButtonProps { rightContent: JSX.Element | string | number; icon?: string; style?: any; leftWidth?: string | number; isLoading?: boolean; disabled?: boolean; onClick?(): void; } export const SplitButton: React.FC<SplitButtonProps> = ({ rightContent, icon, style, leftWidth, isLoading, disabled, onClick, children, }) => { return ( <Flex style={style}> <HalfButton borderRadius="4px 0 0 4px" icon={icon} onClick={onClick} style={{ paddingLeft: icon && 20, opacity: 1 }} disabled={disabled} > <Box width={leftWidth}>{isLoading ? <Loader style={{ overflow: "visible" }} m="auto" /> : children}</Box> </HalfButton> <HalfButton disabled borderRadius="0 4px 4px 0" style={{ borderLeft: 0, opacity: 1, backgroundColor: colors.nearWhite }} > {rightContent} </HalfButton> </Flex> ); }; |