* Fixed ActionBar paddings and added transition on button hover * Added recoil library for state management * Refactor table state with recoil : - Removed table internal states - Added refetchQueries to plug apollo store directly into tables - Added an action bar component that manages itself - Use recoil state and selector for row selection - Refactored Companies and People tables * Moved hook * Cleaned some files * Fix bug infinite re-compute table row selection --------- Co-authored-by: Charles Bochet <charles@twenty.com>
39 lines
801 B
TypeScript
39 lines
801 B
TypeScript
import styled from '@emotion/styled';
|
|
import { ReactNode } from 'react';
|
|
|
|
type OwnProps = {
|
|
icon: ReactNode;
|
|
label: string;
|
|
onClick: () => void;
|
|
};
|
|
|
|
const StyledButton = styled.div`
|
|
display: flex;
|
|
cursor: pointer;
|
|
user-select: none;
|
|
|
|
justify-content: center;
|
|
|
|
padding: ${(props) => props.theme.spacing(2)};
|
|
border-radius: 4px;
|
|
transition: background 0.1s ease;
|
|
|
|
&:hover {
|
|
background: ${(props) => props.theme.tertiaryBackground};
|
|
}
|
|
`;
|
|
|
|
const StyledButtonLabel = styled.div`
|
|
margin-left: ${(props) => props.theme.spacing(2)};
|
|
font-weight: 500;
|
|
`;
|
|
|
|
export function EntityTableActionBarButton({ label, icon, onClick }: OwnProps) {
|
|
return (
|
|
<StyledButton onClick={onClick}>
|
|
{icon}
|
|
<StyledButtonLabel>{label}</StyledButtonLabel>
|
|
</StyledButton>
|
|
);
|
|
}
|