Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection chip #373

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions packages/components/src/custom/ConnectionChip/ConnectionChip.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { ChipProps, TooltipProps } from '@mui/material';
import React from 'react';
import { Chip } from '../../base/Chip';
import { Tooltip } from '../../base/Tooltip';

export interface ConnectionChipProps {
tooltip: string;
tooltipPlacement?: TooltipProps['placement'];
variant?: ChipProps['variant'];
label: string;
icon?: React.ReactElement;
onClick?: () => void;
onDelete?: () => void;
style?: React.CSSProperties;
}

function ConnectionChip({
tooltip,
tooltipPlacement = 'top',
variant = 'filled',
label,
icon,
onClick,
onDelete,
style,
...rest
}: ConnectionChipProps): JSX.Element {
return (
<Tooltip title={tooltip} placement={tooltipPlacement}>
<Chip
sx={{
paddingY: '10px',
padding: '5px 6px !important',
color: 'black',
fontSize: '14px',
textTransform: 'uppercase',
fontWeight: 400,
height: 'unset',
borderRadius: '100px',
border: '0.5px solid #51636B',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No theme reference?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to use theme, you can use theme inline, or create a styled component calling theme

background: 'white',
maxWidth: '230px'
}}
variant={variant}
label={label}
onClick={onClick}
onDelete={onDelete}
icon={icon}
style={style}
{...rest}
/>
</Tooltip>
);
}

export default ConnectionChip;
3 changes: 3 additions & 0 deletions packages/components/src/custom/ConnectionChip/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ConnectionChip from './ConnectionChip';

export { ConnectionChip };
3 changes: 2 additions & 1 deletion packages/components/src/custom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { useWindowDimensions } from './Helpers/Dimension';
import { useNotificationHandler } from './Helpers/Notification';
import { StyledTooltip } from './Tooltip';
import { ConnectionChip } from './ConnectionChip';

export { StyledChartDialog } from './ChartDialog';
export { StyledSearchBar } from './StyledSearchBar';
export { StyledTooltip, useNotificationHandler, useWindowDimensions };
export { ConnectionChip, StyledTooltip, useNotificationHandler, useWindowDimensions };
Loading