Skip to content

Commit

Permalink
Margin control to insomnia-component styled buttons (#3429)
Browse files Browse the repository at this point in the history
  • Loading branch information
reynolek committed Jun 2, 2021
1 parent 3ba7b88 commit fa23003
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FunctionComponent, useMemo } from 'react';
import styled from 'styled-components';
import { getGrpcPathSegments, getShortGrpcPath } from '../../../../common/grpc-paths';
import { Button, Tooltip } from 'insomnia-components';
import { Button, ButtonProps, Tooltip } from 'insomnia-components';

const FlexSpaceBetween = styled.span`
width: 100%;
Expand All @@ -25,8 +25,15 @@ const useLabel = (fullPath?: string) =>
return 'Select Method';
}, [fullPath]);

const buttonProps: ButtonProps = {
className: 'tall wide',
variant: 'text',
size: 'medium',
radius: '0',
};

const GrpcMethodDropdownButton: FunctionComponent<Props> = ({ fullPath }) => (
<Button className="tall wide" variant="text" size="medium" radius="0">
<Button {...buttonProps}>
<Tooltip className="tall wide" message={fullPath} position="bottom" delay={500}>
<FlexSpaceBetween>
{useLabel(fullPath)}
Expand Down
2 changes: 2 additions & 0 deletions packages/insomnia-components/src/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
variant?: ValueOf<typeof ButtonVariantEnum>;
size?: ValueOf<typeof ButtonSizeEnum>;
radius?: string;
margin?: string;
}

const StyledButton = styled.button<ButtonProps>`
color: ${({ bg }) => (bg ? `var(--color-${bg})` : 'var(--color-font)')};
margin: ${({ margin }) => (margin || 0)};
text-align: center;
font-size: var(--font-size-sm);
display: inline-flex !important;
Expand Down

0 comments on commit fa23003

Please sign in to comment.