Design fixes (#696)

* Design fixes

* Fix design

* unused code

* Fix tests
This commit is contained in:
Charles Bochet
2023-07-16 17:36:40 -07:00
committed by GitHub
parent 6ced8434bd
commit 4cb856a180
42 changed files with 177 additions and 339 deletions

View File

@ -29,6 +29,7 @@ export function useOpenCreateCommentThreadDrawerForSelectedRowIds() {
viewableCommentThreadIdState, viewableCommentThreadIdState,
); );
const setHotkeyScope = useSetHotkeyScope(); const setHotkeyScope = useSetHotkeyScope();
setHotkeyScope(RightDrawerHotkeyScope.RightDrawer, { goto: false });
const [, setCommentableEntityArray] = useRecoilState( const [, setCommentableEntityArray] = useRecoilState(
commentableEntityArrayState, commentableEntityArrayState,

View File

@ -27,6 +27,7 @@ export function CompanyAccountOwnerCell({ company }: OwnProps) {
return ( return (
<EditableCell <EditableCell
transparent
editHotkeyScope={{ scope: RelationPickerHotkeyScope.RelationPicker }} editHotkeyScope={{ scope: RelationPickerHotkeyScope.RelationPicker }}
editModeContent={ editModeContent={
<CompanyAccountOwnerPicker <CompanyAccountOwnerPicker

View File

@ -1,10 +1,7 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useOpenTimelineRightDrawer } from '@/activities/hooks/useOpenTimelineRightDrawer';
import { CellCommentChip } from '@/activities/table/components/CellCommentChip';
import { EditableCellChip } from '@/ui/table/editable-cell/types/EditableChip'; import { EditableCellChip } from '@/ui/table/editable-cell/types/EditableChip';
import { import {
CommentableType,
GetCompaniesQuery, GetCompaniesQuery,
useUpdateCompanyMutation, useUpdateCompanyMutation,
} from '~/generated/graphql'; } from '~/generated/graphql';
@ -20,23 +17,10 @@ type OwnProps = {
}; };
export function CompanyEditableNameChipCell({ company }: OwnProps) { export function CompanyEditableNameChipCell({ company }: OwnProps) {
const openCommentRightDrawer = useOpenTimelineRightDrawer();
const [updateCompany] = useUpdateCompanyMutation(); const [updateCompany] = useUpdateCompanyMutation();
const [internalValue, setInternalValue] = useState(company.name ?? ''); const [internalValue, setInternalValue] = useState(company.name ?? '');
function handleCommentClick(event: React.MouseEvent<HTMLDivElement>) {
event.preventDefault();
event.stopPropagation();
openCommentRightDrawer([
{
type: CommentableType.Company,
id: company.id,
},
]);
}
useEffect(() => { useEffect(() => {
setInternalValue(company.name ?? ''); setInternalValue(company.name ?? '');
}, [company.name]); }, [company.name]);
@ -49,12 +33,6 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
id={company.id} id={company.id}
changeHandler={setInternalValue} changeHandler={setInternalValue}
ChipComponent={CompanyChip} ChipComponent={CompanyChip}
rightEndContents={[
<CellCommentChip
count={company._commentThreadCount ?? 0}
onClick={handleCommentClick}
/>,
]}
onSubmit={() => onSubmit={() =>
updateCompany({ updateCompany({
variables: { variables: {

View File

@ -1,9 +1,7 @@
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { useOpenTimelineRightDrawer } from '@/activities/hooks/useOpenTimelineRightDrawer';
import { CellCommentChip } from '@/activities/table/components/CellCommentChip';
import { EditableCellDoubleText } from '@/ui/table/editable-cell/types/EditableCellDoubleText'; import { EditableCellDoubleText } from '@/ui/table/editable-cell/types/EditableCellDoubleText';
import { CommentableType, Person } from '~/generated/graphql'; import { Person } from '~/generated/graphql';
import { PersonChip } from './PersonChip'; import { PersonChip } from './PersonChip';
@ -26,18 +24,12 @@ const NoEditModeContainer = styled.div`
width: 100%; width: 100%;
`; `;
const RightContainer = styled.div`
margin-left: ${(props) => props.theme.spacing(1)};
`;
export function EditablePeopleFullName({ export function EditablePeopleFullName({
person, person,
onChange, onChange,
onSubmit, onSubmit,
onCancel, onCancel,
}: OwnProps) { }: OwnProps) {
const openCommentRightDrawer = useOpenTimelineRightDrawer();
function handleDoubleTextChange( function handleDoubleTextChange(
firstValue: string, firstValue: string,
secondValue: string, secondValue: string,
@ -45,22 +37,6 @@ export function EditablePeopleFullName({
onChange(firstValue, secondValue); onChange(firstValue, secondValue);
} }
function handleCommentClick(event: React.MouseEvent<HTMLDivElement>) {
event.preventDefault();
event.stopPropagation();
if (!person) {
return;
}
openCommentRightDrawer([
{
type: CommentableType.Person,
id: person.id ?? '',
},
]);
}
return ( return (
<EditableCellDoubleText <EditableCellDoubleText
firstValue={person?.firstName ?? ''} firstValue={person?.firstName ?? ''}
@ -76,12 +52,6 @@ export function EditablePeopleFullName({
name={person?.firstName + ' ' + person?.lastName} name={person?.firstName + ' ' + person?.lastName}
id={person?.id ?? ''} id={person?.id ?? ''}
/> />
<RightContainer>
<CellCommentChip
count={person?._commentThreadCount ?? 0}
onClick={handleCommentClick}
/>
</RightContainer>
</NoEditModeContainer> </NoEditModeContainer>
} }
/> />

View File

@ -24,6 +24,7 @@ export function PeopleCompanyCell({ people }: OwnProps) {
return ( return (
<EditableCell <EditableCell
transparent
editHotkeyScope={{ scope: RelationPickerHotkeyScope.RelationPicker }} editHotkeyScope={{ scope: RelationPickerHotkeyScope.RelationPicker }}
editModeContent={ editModeContent={
isCreating ? ( isCreating ? (

View File

@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
import { useRecoilValue } from 'recoil'; import { useRecoilValue } from 'recoil';
import { peopleCityFamilyState } from '@/people/states/peopleCityFamilyState'; import { peopleCityFamilyState } from '@/people/states/peopleCityFamilyState';
import { EditableCellPhone } from '@/ui/table/editable-cell/types/EditableCellPhone'; import { EditableCellText } from '@/ui/table/editable-cell/types/EditableCellText';
import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId'; import { useCurrentRowEntityId } from '@/ui/table/hooks/useCurrentEntityId';
import { useUpdatePeopleMutation } from '~/generated/graphql'; import { useUpdatePeopleMutation } from '~/generated/graphql';
@ -20,7 +20,7 @@ export function EditablePeopleCityCell() {
}, [city]); }, [city]);
return ( return (
<EditableCellPhone <EditableCellText
value={internalValue} value={internalValue}
onChange={setInternalValue} onChange={setInternalValue}
onSubmit={() => onSubmit={() =>

View File

@ -18,7 +18,7 @@ type StyledContainerProps = {
const StyledContainer = styled.div<StyledContainerProps>` const StyledContainer = styled.div<StyledContainerProps>`
align-items: center; align-items: center;
background: ${({ theme }) => theme.background.secondary}; background: ${({ theme }) => theme.background.secondary};
border: 1px solid ${({ theme }) => theme.border.color.light}; border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.border.radius.md}; border-radius: ${({ theme }) => theme.border.radius.md};
bottom: ${(props) => (props.position.x ? 'auto' : '38px')}; bottom: ${(props) => (props.position.x ? 'auto' : '38px')};
box-shadow: ${({ theme }) => theme.boxShadow.strong}; box-shadow: ${({ theme }) => theme.boxShadow.strong};

View File

@ -1,19 +1,19 @@
import styled from '@emotion/styled'; import styled from '@emotion/styled';
export const DropdownMenu = styled.div<{ disableBlur?: boolean }>` export const DropdownMenu = styled.div<{ disableBlur?: boolean }>`
align-items: center;
backdrop-filter: ${({ disableBlur }) => backdrop-filter: ${({ disableBlur }) =>
disableBlur ? 'none' : 'blur(20px)'}; disableBlur ? 'none' : 'blur(20px)'};
background: ${({ theme }) => theme.background.transparent.secondary}; background: ${({ theme }) => theme.background.transparent.secondary};
border: 1px solid ${({ theme }) => theme.border.color.light}; border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.border.radius.md}; border-radius: ${({ theme }) => theme.border.radius.md};
box-shadow: ${({ theme }) => theme.boxShadow.strong}; box-shadow: ${({ theme }) => theme.boxShadow.strong};
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 200px; min-width: 160px;
overflow: hidden;
`; `;

View File

@ -1,30 +0,0 @@
import styled from '@emotion/styled';
import { hoverBackground } from '@/ui/themes/effects';
export const DropdownMenuButton = styled.div`
--horizontal-padding: ${({ theme }) => theme.spacing(1.5)};
--vertical-padding: ${({ theme }) => theme.spacing(2)};
align-items: center;
border-radius: ${({ theme }) => theme.border.radius.md};
color: ${({ theme }) => theme.font.color.secondary};
cursor: pointer;
display: flex;
flex-direction: row;
font-size: ${({ theme }) => theme.font.size.sm};
gap: ${({ theme }) => theme.spacing(2)};
height: calc(32px - 2 * var(--vertical-padding));
padding: var(--vertical-padding) var(--horizontal-padding);
${hoverBackground};
user-select: none;
width: calc(100% - 2 * var(--horizontal-padding));
`;

View File

@ -3,7 +3,7 @@ import styled from '@emotion/styled';
import { Checkbox } from '@/ui/input/components/Checkbox'; import { Checkbox } from '@/ui/input/components/Checkbox';
import { DropdownMenuButton } from './DropdownMenuButton'; import { DropdownMenuItem } from './DropdownMenuItem';
type Props = { type Props = {
checked: boolean; checked: boolean;
@ -11,7 +11,7 @@ type Props = {
id?: string; id?: string;
}; };
const DropdownMenuCheckableItemContainer = styled(DropdownMenuButton)` const DropdownMenuCheckableItemContainer = styled(DropdownMenuItem)`
align-items: center; align-items: center;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;

View File

@ -1,7 +1,9 @@
import styled from '@emotion/styled'; import styled from '@emotion/styled';
export const DropdownMenuItem = styled.div` import { hoverBackground } from '@/ui/themes/effects';
--horizontal-padding: ${({ theme }) => theme.spacing(1.5)};
export const DropdownMenuItem = styled.li`
--horizontal-padding: ${({ theme }) => theme.spacing(1)};
--vertical-padding: ${({ theme }) => theme.spacing(2)}; --vertical-padding: ${({ theme }) => theme.spacing(2)};
align-items: center; align-items: center;
@ -9,8 +11,10 @@ export const DropdownMenuItem = styled.div`
border-radius: ${({ theme }) => theme.border.radius.sm}; border-radius: ${({ theme }) => theme.border.radius.sm};
color: ${({ theme }) => theme.font.color.secondary}; color: ${({ theme }) => theme.font.color.secondary};
cursor: pointer;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
font-size: ${({ theme }) => theme.font.size.sm}; font-size: ${({ theme }) => theme.font.size.sm};
gap: ${({ theme }) => theme.spacing(2)}; gap: ${({ theme }) => theme.spacing(2)};
@ -18,5 +22,9 @@ export const DropdownMenuItem = styled.div`
height: calc(32px - 2 * var(--vertical-padding)); height: calc(32px - 2 * var(--vertical-padding));
padding: var(--vertical-padding) var(--horizontal-padding); padding: var(--vertical-padding) var(--horizontal-padding);
${hoverBackground};
user-select: none;
width: calc(100% - 2 * var(--horizontal-padding)); width: calc(100% - 2 * var(--horizontal-padding));
`; `;

View File

@ -1,7 +1,9 @@
import styled from '@emotion/styled'; import styled from '@emotion/styled';
export const DropdownMenuItemContainer = styled.div` export const DropdownMenuItemsContainer = styled.div<{
--padding: ${({ theme }) => theme.spacing(1 / 2)}; hasMaxHeight?: boolean;
}>`
--padding: ${({ theme }) => theme.spacing(1)};
align-items: flex-start; align-items: flex-start;
display: flex; display: flex;
@ -9,7 +11,7 @@ export const DropdownMenuItemContainer = styled.div`
flex-direction: column; flex-direction: column;
gap: 2px; gap: 2px;
height: 100%; height: 100%;
max-height: 180px; max-height: ${({ hasMaxHeight }) => (hasMaxHeight ? '180px' : 'none')};
overflow-y: auto; overflow-y: auto;
padding: var(--padding); padding: var(--padding);

View File

@ -7,7 +7,6 @@ export const DropdownMenuSearchContainer = styled.div`
--vertical-padding: ${({ theme }) => theme.spacing(1)}; --vertical-padding: ${({ theme }) => theme.spacing(1)};
align-items: center; align-items: center;
border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -5,7 +5,7 @@ import styled from '@emotion/styled';
import { IconCheck } from '@/ui/icon/index'; import { IconCheck } from '@/ui/icon/index';
import { hoverBackground } from '@/ui/themes/effects'; import { hoverBackground } from '@/ui/themes/effects';
import { DropdownMenuButton } from './DropdownMenuButton'; import { DropdownMenuItem } from './DropdownMenuItem';
type Props = { type Props = {
selected?: boolean; selected?: boolean;
@ -13,7 +13,7 @@ type Props = {
hovered?: boolean; hovered?: boolean;
}; };
const DropdownMenuSelectableItemContainer = styled(DropdownMenuButton)<Props>` const DropdownMenuSelectableItemContainer = styled(DropdownMenuItem)<Props>`
${hoverBackground}; ${hoverBackground};
align-items: center; align-items: center;

View File

@ -7,10 +7,9 @@ import { Avatar } from '@/users/components/Avatar';
import { getRenderWrapperForComponent } from '~/testing/renderWrappers'; import { getRenderWrapperForComponent } from '~/testing/renderWrappers';
import { DropdownMenu } from '../DropdownMenu'; import { DropdownMenu } from '../DropdownMenu';
import { DropdownMenuButton } from '../DropdownMenuButton';
import { DropdownMenuCheckableItem } from '../DropdownMenuCheckableItem'; import { DropdownMenuCheckableItem } from '../DropdownMenuCheckableItem';
import { DropdownMenuItem } from '../DropdownMenuItem'; import { DropdownMenuItem } from '../DropdownMenuItem';
import { DropdownMenuItemContainer } from '../DropdownMenuItemContainer'; import { DropdownMenuItemsContainer } from '../DropdownMenuItemsContainer';
import { DropdownMenuSearch } from '../DropdownMenuSearch'; import { DropdownMenuSearch } from '../DropdownMenuSearch';
import { DropdownMenuSelectableItem } from '../DropdownMenuSelectableItem'; import { DropdownMenuSelectableItem } from '../DropdownMenuSelectableItem';
import { DropdownMenuSeparator } from '../DropdownMenuSeparator'; import { DropdownMenuSeparator } from '../DropdownMenuSeparator';
@ -128,9 +127,9 @@ export const EmptyWithContentBelow: Story = {
export const SimpleMenuItem: Story = { export const SimpleMenuItem: Story = {
render: getRenderWrapperForComponent( render: getRenderWrapperForComponent(
<DropdownMenuStoryWrapper> <DropdownMenuStoryWrapper>
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
<FakeMenuItemList /> <FakeMenuItemList />
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
</DropdownMenuStoryWrapper>, </DropdownMenuStoryWrapper>,
), ),
}; };
@ -143,9 +142,9 @@ export const Search: Story = {
<DropdownMenu> <DropdownMenu>
<DropdownMenuSearch /> <DropdownMenuSearch />
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
<FakeMenuItemList /> <FakeMenuItemList />
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
</DropdownMenu> </DropdownMenu>
</MenuAbsolutePositionWrapper> </MenuAbsolutePositionWrapper>
</FakeBelowContainer>, </FakeBelowContainer>,
@ -176,16 +175,16 @@ export const Button: Story = {
<FakeContentBelow /> <FakeContentBelow />
<MenuAbsolutePositionWrapper> <MenuAbsolutePositionWrapper>
<DropdownMenu> <DropdownMenu>
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
<DropdownMenuButton> <DropdownMenuItem>
<IconPlus size={16} /> <IconPlus size={16} />
<div>Create new</div> <div>Create new</div>
</DropdownMenuButton> </DropdownMenuItem>
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
<FakeSelectableMenuItemList /> <FakeSelectableMenuItemList />
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
</DropdownMenu> </DropdownMenu>
</MenuAbsolutePositionWrapper> </MenuAbsolutePositionWrapper>
</FakeBelowContainer>, </FakeBelowContainer>,
@ -198,9 +197,9 @@ export const SelectableMenuItem: Story = {
<FakeContentBelow /> <FakeContentBelow />
<MenuAbsolutePositionWrapper> <MenuAbsolutePositionWrapper>
<DropdownMenu> <DropdownMenu>
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
<FakeSelectableMenuItemList /> <FakeSelectableMenuItemList />
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
</DropdownMenu> </DropdownMenu>
</MenuAbsolutePositionWrapper> </MenuAbsolutePositionWrapper>
</FakeBelowContainer>, </FakeBelowContainer>,
@ -237,9 +236,9 @@ export const SelectableMenuItemWithAvatar: Story = {
<FakeContentBelow /> <FakeContentBelow />
<MenuAbsolutePositionWrapper> <MenuAbsolutePositionWrapper>
<DropdownMenu> <DropdownMenu>
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
<FakeSelectableMenuItemWithAvatarList /> <FakeSelectableMenuItemWithAvatarList />
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
</DropdownMenu> </DropdownMenu>
</MenuAbsolutePositionWrapper> </MenuAbsolutePositionWrapper>
</FakeBelowContainer>, </FakeBelowContainer>,
@ -277,9 +276,9 @@ export const CheckableMenuItem: Story = {
<FakeContentBelow /> <FakeContentBelow />
<MenuAbsolutePositionWrapper> <MenuAbsolutePositionWrapper>
<DropdownMenu> <DropdownMenu>
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
<FakeCheckableMenuItemList /> <FakeCheckableMenuItemList />
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
</DropdownMenu> </DropdownMenu>
</MenuAbsolutePositionWrapper> </MenuAbsolutePositionWrapper>
</FakeBelowContainer>, </FakeBelowContainer>,
@ -323,9 +322,9 @@ export const CheckableMenuItemWithAvatar: Story = {
<FakeContentBelow /> <FakeContentBelow />
<MenuAbsolutePositionWrapper> <MenuAbsolutePositionWrapper>
<DropdownMenu> <DropdownMenu>
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
<FakeCheckableMenuItemWithAvatarList /> <FakeCheckableMenuItemWithAvatarList />
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
</DropdownMenu> </DropdownMenu>
</MenuAbsolutePositionWrapper> </MenuAbsolutePositionWrapper>
</FakeBelowContainer>, </FakeBelowContainer>,

View File

@ -2,10 +2,10 @@ import { ReactNode, useRef } from 'react';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { Key } from 'ts-key-enum'; import { Key } from 'ts-key-enum';
import { DropdownMenu } from '@/ui/dropdown/components/DropdownMenu';
import { useOutsideAlerter } from '@/ui/hooks/useOutsideAlerter'; import { useOutsideAlerter } from '@/ui/hooks/useOutsideAlerter';
import { useScopedHotkeys } from '@/ui/hotkey/hooks/useScopedHotkeys'; import { useScopedHotkeys } from '@/ui/hotkey/hooks/useScopedHotkeys';
import { IconChevronDown } from '@/ui/icon/index'; import { IconChevronDown } from '@/ui/icon/index';
import { overlayBackground, textInputStyle } from '@/ui/themes/effects';
import { FiltersHotkeyScope } from '../types/FiltersHotkeyScope'; import { FiltersHotkeyScope } from '../types/FiltersHotkeyScope';
@ -50,69 +50,22 @@ const StyledDropdownButton = styled.div<StyledDropdownButtonProps>`
} }
`; `;
const StyledDropdown = styled.ul` const StyledDropdownMenuContainer = styled.ul`
--outer-border-radius: calc(var(--wraper-border-radius) - 2px);
--wraper-border: 1px;
--wraper-border-radius: ${({ theme }) => theme.border.radius.md};
border: var(--wraper-border) solid ${({ theme }) => theme.border.color.light};
border-radius: var(--wraper-border-radius);
display: flex;
flex-direction: column;
min-width: 160px;
padding: 0px;
position: absolute; position: absolute;
right: 0; right: 0;
top: 14px; top: 14px;
${overlayBackground}
li {
&:first-of-type {
border-top-left-radius: var(--outer-border-radius);
border-top-right-radius: var(--outer-border-radius);
}
&:last-of-type {
border-bottom: 0;
border-bottom-left-radius: var(--outer-border-radius);
border-bottom-right-radius: var(--outer-border-radius);
}
}
`;
const StyledDropdownItem = styled.li`
align-items: center;
border-radius: ${({ theme }) => theme.border.radius.xs};
color: ${({ theme }) => theme.font.color.secondary};
cursor: pointer;
display: flex;
margin: 2px;
padding: ${({ theme }) => theme.spacing(2)}
calc(${({ theme }) => theme.spacing(2)} - 2px);
user-select: none;
width: calc(160px - ${({ theme }) => theme.spacing(4)});
&:hover {
background: ${({ theme }) => theme.background.transparent.light};
}
`;
const StyledDropdownItemClipped = styled.span`
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
`; `;
const StyledDropdownTopOption = styled.li` const StyledDropdownTopOption = styled.li`
align-items: center;
border-bottom: 1px solid ${({ theme }) => theme.border.color.light};
color: ${({ theme }) => theme.font.color.primary}; color: ${({ theme }) => theme.font.color.primary};
cursor: pointer; cursor: pointer;
display: flex; display: flex;
font-size: ${({ theme }) => theme.font.size.sm}; font-size: ${({ theme }) => theme.font.size.sm};
font-weight: ${({ theme }) => theme.font.weight.medium}; font-weight: ${({ theme }) => theme.font.weight.medium};
justify-content: space-between; justify-content: space-between;
padding: calc(${({ theme }) => theme.spacing(2)}) padding: calc(${({ theme }) => theme.spacing(2)})
calc(${({ theme }) => theme.spacing(2)}); calc(${({ theme }) => theme.spacing(2)});
&:hover { &:hover {
background: ${({ theme }) => theme.background.transparent.light}; background: ${({ theme }) => theme.background.transparent.light};
} }
@ -126,35 +79,6 @@ const StyledIcon = styled.div`
min-width: ${({ theme }) => theme.spacing(4)}; min-width: ${({ theme }) => theme.spacing(4)};
`; `;
const StyledSearchField = styled.li`
align-items: center;
border-bottom: var(--wraper-border) solid
${({ theme }) => theme.border.color.light};
color: ${({ theme }) => theme.font.color.secondary};
cursor: pointer;
display: flex;
font-weight: ${({ theme }) => theme.font.weight.medium};
justify-content: space-between;
overflow: hidden;
user-select: none;
input {
border-radius: ${({ theme }) => theme.border.radius.md};
box-sizing: border-box;
font-family: ${({ theme }) => theme.font.family};
height: 36px;
padding: 8px;
width: 100%;
${textInputStyle}
&:focus {
outline: 0 none;
}
}
`;
function DropdownButton({ function DropdownButton({
label, label,
isActive, isActive,
@ -194,7 +118,9 @@ function DropdownButton({
{label} {label}
</StyledDropdownButton> </StyledDropdownButton>
{isUnfolded && ( {isUnfolded && (
<StyledDropdown ref={dropdownRef}>{children}</StyledDropdown> <StyledDropdownMenuContainer>
<DropdownMenu ref={dropdownRef}>{children}</DropdownMenu>
</StyledDropdownMenuContainer>
)} )}
</StyledDropdownButtonContainer> </StyledDropdownButtonContainer>
); );
@ -215,9 +141,6 @@ function DropdownTopOptionAngleDown() {
</StyleAngleDownContainer> </StyleAngleDownContainer>
); );
} }
DropdownButton.StyledDropdownItem = StyledDropdownItem;
DropdownButton.StyledDropdownItemClipped = StyledDropdownItemClipped;
DropdownButton.StyledSearchField = StyledSearchField;
DropdownButton.StyledDropdownTopOption = StyledDropdownTopOption; DropdownButton.StyledDropdownTopOption = StyledDropdownTopOption;
DropdownButton.StyledDropdownTopOptionAngleDown = DropdownTopOptionAngleDown; DropdownButton.StyledDropdownTopOptionAngleDown = DropdownTopOptionAngleDown;
DropdownButton.StyledIcon = StyledIcon; DropdownButton.StyledIcon = StyledIcon;

View File

@ -1,6 +1,7 @@
import { Context, useCallback, useState } from 'react'; import { Context, useCallback, useState } from 'react';
import { Key } from 'ts-key-enum'; import { Key } from 'ts-key-enum';
import { DropdownMenuSeparator } from '@/ui/dropdown/components/DropdownMenuSeparator';
import { filterDefinitionUsedInDropdownScopedState } from '@/ui/filter-n-sort/states/filterDefinitionUsedInDropdownScopedState'; import { filterDefinitionUsedInDropdownScopedState } from '@/ui/filter-n-sort/states/filterDefinitionUsedInDropdownScopedState';
import { filterDropdownSearchInputScopedState } from '@/ui/filter-n-sort/states/filterDropdownSearchInputScopedState'; import { filterDropdownSearchInputScopedState } from '@/ui/filter-n-sort/states/filterDropdownSearchInputScopedState';
import { filtersScopedState } from '@/ui/filter-n-sort/states/filtersScopedState'; import { filtersScopedState } from '@/ui/filter-n-sort/states/filtersScopedState';
@ -107,20 +108,19 @@ export function FilterDropdownButton({
selectedOperandInDropdown && ( selectedOperandInDropdown && (
<> <>
<FilterDropdownOperandButton context={context} /> <FilterDropdownOperandButton context={context} />
<DropdownButton.StyledSearchField autoFocus key={'search-filter'}> <DropdownMenuSeparator />
{filterDefinitionUsedInDropdown.type === 'text' && ( {filterDefinitionUsedInDropdown.type === 'text' && (
<FilterDropdownTextSearchInput context={context} /> <FilterDropdownTextSearchInput context={context} />
)} )}
{filterDefinitionUsedInDropdown.type === 'number' && ( {filterDefinitionUsedInDropdown.type === 'number' && (
<FilterDropdownNumberSearchInput context={context} /> <FilterDropdownNumberSearchInput context={context} />
)} )}
{filterDefinitionUsedInDropdown.type === 'date' && ( {filterDefinitionUsedInDropdown.type === 'date' && (
<FilterDropdownDateSearchInput context={context} /> <FilterDropdownDateSearchInput context={context} />
)} )}
{filterDefinitionUsedInDropdown.type === 'entity' && ( {filterDefinitionUsedInDropdown.type === 'entity' && (
<FilterDropdownEntitySearchInput context={context} /> <FilterDropdownEntitySearchInput context={context} />
)} )}
</DropdownButton.StyledSearchField>
{filterDefinitionUsedInDropdown.type === 'entity' && ( {filterDefinitionUsedInDropdown.type === 'entity' && (
<FilterDropdownEntitySelect context={context} /> <FilterDropdownEntitySelect context={context} />
)} )}

View File

@ -1,5 +1,6 @@
import { ChangeEvent, Context } from 'react'; import { ChangeEvent, Context } from 'react';
import { DropdownMenuSearch } from '@/ui/dropdown/components/DropdownMenuSearch';
import { filterDefinitionUsedInDropdownScopedState } from '@/ui/filter-n-sort/states/filterDefinitionUsedInDropdownScopedState'; import { filterDefinitionUsedInDropdownScopedState } from '@/ui/filter-n-sort/states/filterDefinitionUsedInDropdownScopedState';
import { filterDropdownSearchInputScopedState } from '@/ui/filter-n-sort/states/filterDropdownSearchInputScopedState'; import { filterDropdownSearchInputScopedState } from '@/ui/filter-n-sort/states/filterDropdownSearchInputScopedState';
import { selectedOperandInDropdownScopedState } from '@/ui/filter-n-sort/states/selectedOperandInDropdownScopedState'; import { selectedOperandInDropdownScopedState } from '@/ui/filter-n-sort/states/selectedOperandInDropdownScopedState';
@ -26,7 +27,7 @@ export function FilterDropdownEntitySearchInput({
return ( return (
filterDefinitionUsedInDropdown && filterDefinitionUsedInDropdown &&
selectedOperandInDropdown && ( selectedOperandInDropdown && (
<input <DropdownMenuSearch
type="text" type="text"
value={filterDropdownSearchInput} value={filterDropdownSearchInput}
placeholder={filterDefinitionUsedInDropdown.label} placeholder={filterDefinitionUsedInDropdown.label}

View File

@ -1,6 +1,6 @@
import { Context } from 'react'; import { Context } from 'react';
import { DropdownMenuItemContainer } from '@/ui/dropdown/components/DropdownMenuItemContainer'; import { DropdownMenuItemsContainer } from '@/ui/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSelectableItem } from '@/ui/dropdown/components/DropdownMenuSelectableItem'; import { DropdownMenuSelectableItem } from '@/ui/dropdown/components/DropdownMenuSelectableItem';
import { useSetHotkeyScope } from '@/ui/hotkey/hooks/useSetHotkeyScope'; import { useSetHotkeyScope } from '@/ui/hotkey/hooks/useSetHotkeyScope';
import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedState'; import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedState';
@ -43,7 +43,7 @@ export function FilterDropdownFilterSelect({
const setHotkeyScope = useSetHotkeyScope(); const setHotkeyScope = useSetHotkeyScope();
return ( return (
<DropdownMenuItemContainer style={{ maxHeight: '300px' }}> <DropdownMenuItemsContainer>
{availableFilters.map((availableFilter, index) => ( {availableFilters.map((availableFilter, index) => (
<DropdownMenuSelectableItem <DropdownMenuSelectableItem
key={`select-filter-${index}`} key={`select-filter-${index}`}
@ -67,6 +67,6 @@ export function FilterDropdownFilterSelect({
{availableFilter.label} {availableFilter.label}
</DropdownMenuSelectableItem> </DropdownMenuSelectableItem>
))} ))}
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
); );
} }

View File

@ -1,5 +1,6 @@
import { ChangeEvent, Context } from 'react'; import { ChangeEvent, Context } from 'react';
import { DropdownMenuSearch } from '@/ui/dropdown/components/DropdownMenuSearch';
import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedState'; import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedState';
import { useRemoveFilter } from '../hooks/useRemoveFilter'; import { useRemoveFilter } from '../hooks/useRemoveFilter';
@ -28,7 +29,7 @@ export function FilterDropdownNumberSearchInput({
return ( return (
filterDefinitionUsedInDropdown && filterDefinitionUsedInDropdown &&
selectedOperandInDropdown && ( selectedOperandInDropdown && (
<input <DropdownMenuSearch
type="number" type="number"
placeholder={filterDefinitionUsedInDropdown.label} placeholder={filterDefinitionUsedInDropdown.label}
onChange={(event: ChangeEvent<HTMLInputElement>) => { onChange={(event: ChangeEvent<HTMLInputElement>) => {

View File

@ -1,6 +1,7 @@
import { Context } from 'react'; import { Context } from 'react';
import { DropdownMenuItemContainer } from '@/ui/dropdown/components/DropdownMenuItemContainer'; import { DropdownMenuItem } from '@/ui/dropdown/components/DropdownMenuItem';
import { DropdownMenuItemsContainer } from '@/ui/dropdown/components/DropdownMenuItemsContainer';
import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedState'; import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedState';
import { useFilterCurrentlyEdited } from '../hooks/useFilterCurrentlyEdited'; import { useFilterCurrentlyEdited } from '../hooks/useFilterCurrentlyEdited';
@ -12,8 +13,6 @@ import { FilterOperand } from '../types/FilterOperand';
import { getOperandLabel } from '../utils/getOperandLabel'; import { getOperandLabel } from '../utils/getOperandLabel';
import { getOperandsForFilterType } from '../utils/getOperandsForFilterType'; import { getOperandsForFilterType } from '../utils/getOperandsForFilterType';
import DropdownButton from './DropdownButton';
export function FilterDropdownOperandSelect({ export function FilterDropdownOperandSelect({
context, context,
}: { }: {
@ -63,17 +62,17 @@ export function FilterDropdownOperandSelect({
} }
return ( return (
<DropdownMenuItemContainer> <DropdownMenuItemsContainer>
{operandsForFilterType.map((filterOperand, index) => ( {operandsForFilterType.map((filterOperand, index) => (
<DropdownButton.StyledDropdownItem <DropdownMenuItem
key={`select-filter-operand-${index}`} key={`select-filter-operand-${index}`}
onClick={() => { onClick={() => {
handleOperangeChange(filterOperand); handleOperangeChange(filterOperand);
}} }}
> >
{getOperandLabel(filterOperand)} {getOperandLabel(filterOperand)}
</DropdownButton.StyledDropdownItem> </DropdownMenuItem>
))} ))}
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
); );
} }

View File

@ -1,5 +1,6 @@
import { ChangeEvent, Context } from 'react'; import { ChangeEvent, Context } from 'react';
import { DropdownMenuSearch } from '@/ui/dropdown/components/DropdownMenuSearch';
import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedState'; import { useRecoilScopedState } from '@/ui/recoil-scope/hooks/useRecoilScopedState';
import { useFilterCurrentlyEdited } from '../hooks/useFilterCurrentlyEdited'; import { useFilterCurrentlyEdited } from '../hooks/useFilterCurrentlyEdited';
@ -35,7 +36,7 @@ export function FilterDropdownTextSearchInput({
return ( return (
filterDefinitionUsedInDropdown && filterDefinitionUsedInDropdown &&
selectedOperandInDropdown && ( selectedOperandInDropdown && (
<input <DropdownMenuSearch
type="text" type="text"
placeholder={filterDefinitionUsedInDropdown.label} placeholder={filterDefinitionUsedInDropdown.label}
value={filterCurrentlyEdited?.value ?? filterDropdownSearchInput} value={filterCurrentlyEdited?.value ?? filterDropdownSearchInput}

View File

@ -1,5 +1,9 @@
import { useCallback, useState } from 'react'; import { useCallback, useState } from 'react';
import { DropdownMenuItemsContainer } from '@/ui/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSelectableItem } from '@/ui/dropdown/components/DropdownMenuSelectableItem';
import { DropdownMenuSeparator } from '@/ui/dropdown/components/DropdownMenuSeparator';
import { FiltersHotkeyScope } from '../types/FiltersHotkeyScope'; import { FiltersHotkeyScope } from '../types/FiltersHotkeyScope';
import { SelectedSortType, SortType } from '../types/interface'; import { SelectedSortType, SortType } from '../types/interface';
@ -56,9 +60,10 @@ export function SortDropdownButton<SortField>({
onIsUnfoldedChange={handleIsUnfoldedChange} onIsUnfoldedChange={handleIsUnfoldedChange}
HotkeyScope={HotkeyScope} HotkeyScope={HotkeyScope}
> >
{isOptionUnfolded {isOptionUnfolded ? (
? options.map((option, index) => ( <DropdownMenuItemsContainer>
<DropdownButton.StyledDropdownItem {options.map((option, index) => (
<DropdownMenuSelectableItem
key={index} key={index}
onClick={() => { onClick={() => {
setSelectedSortDirection(option); setSelectedSortDirection(option);
@ -66,19 +71,23 @@ export function SortDropdownButton<SortField>({
}} }}
> >
{option === 'asc' ? 'Ascending' : 'Descending'} {option === 'asc' ? 'Ascending' : 'Descending'}
</DropdownButton.StyledDropdownItem> </DropdownMenuSelectableItem>
)) ))}
: [ </DropdownMenuItemsContainer>
<DropdownButton.StyledDropdownTopOption ) : (
key={0} [
onClick={() => setIsOptionUnfolded(true)} <DropdownButton.StyledDropdownTopOption
> key={0}
{selectedSortDirection === 'asc' ? 'Ascending' : 'Descending'} onClick={() => setIsOptionUnfolded(true)}
>
{selectedSortDirection === 'asc' ? 'Ascending' : 'Descending'}
<DropdownButton.StyledDropdownTopOptionAngleDown /> <DropdownButton.StyledDropdownTopOptionAngleDown />
</DropdownButton.StyledDropdownTopOption>, </DropdownButton.StyledDropdownTopOption>,
...availableSorts.map((sort, index) => ( <DropdownMenuSeparator />,
<DropdownButton.StyledDropdownItem <DropdownMenuItemsContainer>
{availableSorts.map((sort, index) => (
<DropdownMenuSelectableItem
key={index + 1} key={index + 1}
onClick={() => { onClick={() => {
setIsUnfolded(false); setIsUnfolded(false);
@ -89,9 +98,11 @@ export function SortDropdownButton<SortField>({
{sort.icon} {sort.icon}
</DropdownButton.StyledIcon> </DropdownButton.StyledIcon>
{sort.label} {sort.label}
</DropdownButton.StyledDropdownItem> </DropdownMenuSelectableItem>
)), ))}
]} </DropdownMenuItemsContainer>,
]
)}
</DropdownButton> </DropdownButton>
); );
} }

View File

@ -5,7 +5,7 @@ export function getOperandLabel(operand: FilterOperand | null | undefined) {
case 'contains': case 'contains':
return 'Contains'; return 'Contains';
case 'does-not-contain': case 'does-not-contain':
return "Does'nt contain"; return "Doesn't contain";
case 'greater-than': case 'greater-than':
return 'Greater than'; return 'Greater than';
case 'less-than': case 'less-than':

View File

@ -28,7 +28,8 @@ const Picture = styled.button<{ withPicture: boolean }>`
width: 66px; width: 66px;
img { img {
object-fit: cover; height: 100%;
object-fit: fill;
width: 100%; width: 100%;
} }

View File

@ -3,7 +3,7 @@ import styled from '@emotion/styled';
const StyledPanel = styled.div` const StyledPanel = styled.div`
background: ${({ theme }) => theme.background.primary}; background: ${({ theme }) => theme.background.primary};
border: 1px solid ${({ theme }) => theme.border.color.light}; border: 1px solid ${({ theme }) => theme.border.color.medium};
border-radius: ${({ theme }) => theme.border.radius.md}; border-radius: ${({ theme }) => theme.border.radius.md};
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -3,7 +3,7 @@ import styled from '@emotion/styled';
export const ShowPageLeftContainer = styled.div` export const ShowPageLeftContainer = styled.div`
background: ${({ theme }) => theme.background.secondary}; background: ${({ theme }) => theme.background.secondary};
border-bottom-left-radius: 8px; border-bottom-left-radius: 8px;
border-right: 1px solid ${({ theme }) => theme.border.color.light}; border-right: 1px solid ${({ theme }) => theme.border.color.medium};
border-top-left-radius: 8px; border-top-left-radius: 8px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -47,7 +47,7 @@ export function NavbarAnimatedContainer({ children, layout }: NavbarProps) {
opacity: isMenuOpened ? 1 : 0, opacity: isMenuOpened ? 1 : 0,
}} }}
transition={{ transition={{
duration: theme.animation.duration.visible, duration: theme.animation.duration.normal,
}} }}
> >
{children} {children}

View File

@ -3,7 +3,7 @@ import debounce from 'lodash.debounce';
import { DropdownMenu } from '@/ui/dropdown/components/DropdownMenu'; import { DropdownMenu } from '@/ui/dropdown/components/DropdownMenu';
import { DropdownMenuCheckableItem } from '@/ui/dropdown/components/DropdownMenuCheckableItem'; import { DropdownMenuCheckableItem } from '@/ui/dropdown/components/DropdownMenuCheckableItem';
import { DropdownMenuItem } from '@/ui/dropdown/components/DropdownMenuItem'; import { DropdownMenuItem } from '@/ui/dropdown/components/DropdownMenuItem';
import { DropdownMenuItemContainer } from '@/ui/dropdown/components/DropdownMenuItemContainer'; import { DropdownMenuItemsContainer } from '@/ui/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSearch } from '@/ui/dropdown/components/DropdownMenuSearch'; import { DropdownMenuSearch } from '@/ui/dropdown/components/DropdownMenuSearch';
import { DropdownMenuSeparator } from '@/ui/dropdown/components/DropdownMenuSeparator'; import { DropdownMenuSeparator } from '@/ui/dropdown/components/DropdownMenuSeparator';
import { Avatar } from '@/users/components/Avatar'; import { Avatar } from '@/users/components/Avatar';
@ -57,7 +57,7 @@ export function MultipleEntitySelect<
autoFocus autoFocus
/> />
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<DropdownMenuItemContainer> <DropdownMenuItemsContainer hasMaxHeight>
{entitiesInDropdown?.map((entity) => ( {entitiesInDropdown?.map((entity) => (
<DropdownMenuCheckableItem <DropdownMenuCheckableItem
key={entity.id} key={entity.id}
@ -83,7 +83,7 @@ export function MultipleEntitySelect<
{entitiesInDropdown?.length === 0 && ( {entitiesInDropdown?.length === 0 && (
<DropdownMenuItem>No result</DropdownMenuItem> <DropdownMenuItem>No result</DropdownMenuItem>
)} )}
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
</DropdownMenu> </DropdownMenu>
); );
} }

View File

@ -2,8 +2,8 @@ import { useRef } from 'react';
import { useTheme } from '@emotion/react'; import { useTheme } from '@emotion/react';
import { DropdownMenu } from '@/ui/dropdown/components/DropdownMenu'; import { DropdownMenu } from '@/ui/dropdown/components/DropdownMenu';
import { DropdownMenuButton } from '@/ui/dropdown/components/DropdownMenuButton'; import { DropdownMenuItem } from '@/ui/dropdown/components/DropdownMenuItem';
import { DropdownMenuItemContainer } from '@/ui/dropdown/components/DropdownMenuItemContainer'; import { DropdownMenuItemsContainer } from '@/ui/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSearch } from '@/ui/dropdown/components/DropdownMenuSearch'; import { DropdownMenuSearch } from '@/ui/dropdown/components/DropdownMenuSearch';
import { DropdownMenuSeparator } from '@/ui/dropdown/components/DropdownMenuSeparator'; import { DropdownMenuSeparator } from '@/ui/dropdown/components/DropdownMenuSeparator';
import { useListenClickOutsideArrayOfRef } from '@/ui/hooks/useListenClickOutsideArrayOfRef'; import { useListenClickOutsideArrayOfRef } from '@/ui/hooks/useListenClickOutsideArrayOfRef';
@ -60,12 +60,12 @@ export function SingleEntitySelect<
<DropdownMenuSeparator /> <DropdownMenuSeparator />
{showCreateButton && ( {showCreateButton && (
<> <>
<DropdownMenuItemContainer style={{ maxHeight: 180 }}> <DropdownMenuItemsContainer hasMaxHeight>
<DropdownMenuButton onClick={onCreate}> <DropdownMenuItem onClick={onCreate}>
<IconPlus size={theme.icon.size.md} /> <IconPlus size={theme.icon.size.md} />
Create new Create new
</DropdownMenuButton> </DropdownMenuItem>
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
</> </>
)} )}

View File

@ -1,8 +1,9 @@
import { useRef } from 'react'; import { useRef } from 'react';
import Skeleton from 'react-loading-skeleton';
import { Key } from 'ts-key-enum'; import { Key } from 'ts-key-enum';
import { DropdownMenuItem } from '@/ui/dropdown/components/DropdownMenuItem'; import { DropdownMenuItem } from '@/ui/dropdown/components/DropdownMenuItem';
import { DropdownMenuItemContainer } from '@/ui/dropdown/components/DropdownMenuItemContainer'; import { DropdownMenuItemsContainer } from '@/ui/dropdown/components/DropdownMenuItemsContainer';
import { DropdownMenuSelectableItem } from '@/ui/dropdown/components/DropdownMenuSelectableItem'; import { DropdownMenuSelectableItem } from '@/ui/dropdown/components/DropdownMenuSelectableItem';
import { useScopedHotkeys } from '@/ui/hotkey/hooks/useScopedHotkeys'; import { useScopedHotkeys } from '@/ui/hotkey/hooks/useScopedHotkeys';
import { Avatar } from '@/users/components/Avatar'; import { Avatar } from '@/users/components/Avatar';
@ -12,8 +13,7 @@ import { useEntitySelectScroll } from '../hooks/useEntitySelectScroll';
import { EntityForSelect } from '../types/EntityForSelect'; import { EntityForSelect } from '../types/EntityForSelect';
import { RelationPickerHotkeyScope } from '../types/RelationPickerHotkeyScope'; import { RelationPickerHotkeyScope } from '../types/RelationPickerHotkeyScope';
import { CompanyPickerSkeleton } from './skeletons/CompanyPickerSkeleton'; import { DropdownMenuItemsContainerSkeleton } from './skeletons/DropdownMenuItemsContainerSkeleton';
import { DropdownMenuItemContainerSkeleton } from './skeletons/DropdownMenuItemContainerSkeleton';
export type EntitiesForSingleEntitySelect< export type EntitiesForSingleEntitySelect<
CustomEntityForSelect extends EntityForSelect, CustomEntityForSelect extends EntityForSelect,
@ -64,11 +64,11 @@ export function SingleEntitySelectBase<
); );
return ( return (
<DropdownMenuItemContainer ref={containerRef}> <DropdownMenuItemsContainer ref={containerRef} hasMaxHeight>
{entities.loading ? ( {entities.loading ? (
<DropdownMenuItemContainerSkeleton> <DropdownMenuItemsContainerSkeleton>
<CompanyPickerSkeleton count={10} /> <Skeleton height={24} />
</DropdownMenuItemContainerSkeleton> </DropdownMenuItemsContainerSkeleton>
) : entitiesInDropdown.length === 0 ? ( ) : entitiesInDropdown.length === 0 ? (
<DropdownMenuItem>No result</DropdownMenuItem> <DropdownMenuItem>No result</DropdownMenuItem>
) : ( ) : (
@ -90,6 +90,6 @@ export function SingleEntitySelectBase<
</DropdownMenuSelectableItem> </DropdownMenuSelectableItem>
)) ))
)} )}
</DropdownMenuItemContainer> </DropdownMenuItemsContainer>
); );
} }

View File

@ -1,35 +0,0 @@
import Skeleton from 'react-loading-skeleton';
import styled from '@emotion/styled';
type OwnProps = {
count: number;
};
export const SkeletonContainer = styled.div`
align-items: center;
display: inline-flex;
margin-bottom: ${({ theme }) => theme.spacing(1)};
position: relative;
width: 100%;
`;
export const SkeletonEntityName = styled.div`
margin-left: ${({ theme }) => theme.spacing(2)};
width: 100%;
`;
export function CompanyPickerSkeleton({ count }: OwnProps) {
const loadSkeletons = Array(count).fill(1);
return (
<>
{loadSkeletons.map((_, i) => (
<SkeletonContainer key={i}>
<Skeleton width={15} height={15} />
<SkeletonEntityName>
<Skeleton height={8} />
</SkeletonEntityName>
</SkeletonContainer>
))}
</>
);
}

View File

@ -1,20 +0,0 @@
import styled from '@emotion/styled';
export const DropdownMenuItemContainerSkeleton = styled.div`
--horizontal-padding: ${({ theme }) => theme.spacing(1.5)};
--vertical-padding: ${({ theme }) => theme.spacing(2)};
align-items: center;
border-radius: ${({ theme }) => theme.border.radius.sm};
color: ${({ theme }) => theme.font.color.secondary};
font-size: ${({ theme }) => theme.font.size.sm};
gap: ${({ theme }) => theme.spacing(2)};
height: calc(100% - 2 * var(--vertical-padding));
padding: var(--vertical-padding) var(--horizontal-padding);
width: calc(100% - 2 * var(--horizontal-padding));
`;

View File

@ -0,0 +1,16 @@
import styled from '@emotion/styled';
export const DropdownMenuItemsContainerSkeleton = styled.div`
--horizontal-padding: ${({ theme }) => theme.spacing(1)};
--vertical-padding: ${({ theme }) => theme.spacing(1)};
align-items: center;
border-radius: ${({ theme }) => theme.border.radius.sm};
color: blue;
height: calc(100% - 2 * var(--vertical-padding));
padding: var(--vertical-padding) var(--horizontal-padding);
width: calc(100% - 2 * var(--horizontal-padding));
`;

View File

@ -51,17 +51,19 @@ export function RightDrawer() {
return <></>; return <></>;
} }
console.log(isRightDrawerOpen);
return ( return (
<StyledContainer <StyledContainer
animate={{ animate={{
width: isRightDrawerOpen ? theme.rightDrawerWidth : '0', width: isRightDrawerOpen ? theme.rightDrawerWidth : '0',
}} }}
transition={{ transition={{
duration: theme.animation.duration.visible, duration: theme.animation.duration.normal,
}} }}
> >
<StyledRightDrawer ref={rightDrawerRef}> <StyledRightDrawer ref={rightDrawerRef}>
<RightDrawerRouter /> {isRightDrawerOpen && <RightDrawerRouter />}
</StyledRightDrawer> </StyledRightDrawer>
</StyledContainer> </StyledContainer>
); );

View File

@ -27,6 +27,7 @@ type OwnProps = {
editModeHorizontalAlign?: 'left' | 'right'; editModeHorizontalAlign?: 'left' | 'right';
editModeVerticalPosition?: 'over' | 'below'; editModeVerticalPosition?: 'over' | 'below';
editHotkeyScope?: HotkeyScope; editHotkeyScope?: HotkeyScope;
transparent?: boolean;
onSubmit?: () => void; onSubmit?: () => void;
onCancel?: () => void; onCancel?: () => void;
}; };
@ -37,6 +38,7 @@ export function EditableCell({
editModeContent, editModeContent,
nonEditModeContent, nonEditModeContent,
editHotkeyScope, editHotkeyScope,
transparent = false,
onSubmit, onSubmit,
onCancel, onCancel,
}: OwnProps) { }: OwnProps) {
@ -48,6 +50,7 @@ export function EditableCell({
<CellBaseContainer> <CellBaseContainer>
{isCurrentCellInEditMode ? ( {isCurrentCellInEditMode ? (
<EditableCellEditMode <EditableCellEditMode
transparent={transparent}
editModeHorizontalAlign={editModeHorizontalAlign} editModeHorizontalAlign={editModeHorizontalAlign}
editModeVerticalPosition={editModeVerticalPosition} editModeVerticalPosition={editModeVerticalPosition}
onSubmit={onSubmit} onSubmit={onSubmit}

View File

@ -19,7 +19,7 @@ export const EditableCellNormalModeOuterContainer = styled.div<Props>`
${(props) => ${(props) =>
props.softFocus props.softFocus
? `background: ${props.theme.background.transparent.secondary}; ? `background: ${props.theme.background.transparent.secondary};
border-radius: ${props.theme.border.radius.md}; border-radius: ${props.theme.border.radius.sm};
box-shadow: inset 0 0 0 1px ${props.theme.font.color.extraLight};` box-shadow: inset 0 0 0 1px ${props.theme.font.color.extraLight};`
: ''} : ''}
`; `;

View File

@ -7,8 +7,10 @@ import { useRegisterCloseCellHandlers } from '../hooks/useRegisterCloseCellHandl
export const EditableCellEditModeContainer = styled.div<OwnProps>` export const EditableCellEditModeContainer = styled.div<OwnProps>`
align-items: center; align-items: center;
border: 1px solid ${({ theme }) => theme.border.color.light}; border: ${({ transparent, theme }) =>
border-radius: ${({ theme }) => theme.border.radius.sm}; transparent ? 'none' : `1px solid ${theme.border.color.light}`};
border-radius: ${({ transparent, theme }) =>
transparent ? 'none' : theme.border.radius.sm};
display: flex; display: flex;
left: ${(props) => left: ${(props) =>
props.editModeHorizontalAlign === 'right' ? 'auto' : '0'}; props.editModeHorizontalAlign === 'right' ? 'auto' : '0'};
@ -16,18 +18,19 @@ export const EditableCellEditModeContainer = styled.div<OwnProps>`
margin-top: -1px; margin-top: -1px;
min-height: 100%; min-height: 100%;
min-width: 100%;
position: absolute; position: absolute;
right: ${(props) => right: ${(props) =>
props.editModeHorizontalAlign === 'right' ? '0' : 'auto'}; props.editModeHorizontalAlign === 'right' ? '0' : 'auto'};
top: ${(props) => (props.editModeVerticalPosition === 'over' ? '0' : '100%')}; top: ${(props) => (props.editModeVerticalPosition === 'over' ? '0' : '100%')};
width: 100%;
z-index: 1; z-index: 1;
${overlayBackground} ${({ transparent }) => (transparent ? '' : overlayBackground)};
`; `;
type OwnProps = { type OwnProps = {
children: ReactElement; children: ReactElement;
transparent?: boolean;
editModeHorizontalAlign?: 'left' | 'right'; editModeHorizontalAlign?: 'left' | 'right';
editModeVerticalPosition?: 'over' | 'below'; editModeVerticalPosition?: 'over' | 'below';
onOutsideClick?: () => void; onOutsideClick?: () => void;
@ -41,6 +44,7 @@ export function EditableCellEditMode({
children, children,
onCancel, onCancel,
onSubmit, onSubmit,
transparent = false,
}: OwnProps) { }: OwnProps) {
const wrapperRef = useRef(null); const wrapperRef = useRef(null);
@ -48,6 +52,7 @@ export function EditableCellEditMode({
return ( return (
<EditableCellEditModeContainer <EditableCellEditModeContainer
transparent={transparent}
data-testid="editable-cell-edit-mode-container" data-testid="editable-cell-edit-mode-container"
ref={wrapperRef} ref={wrapperRef}
editModeHorizontalAlign={editModeHorizontalAlign} editModeHorizontalAlign={editModeHorizontalAlign}

View File

@ -9,7 +9,7 @@ import { useEditableCell } from '../hooks/useEditableCell';
const EditableCellDateEditModeContainer = styled.div` const EditableCellDateEditModeContainer = styled.div`
margin-top: -1px; margin-top: -1px;
width: inherit; width: 100%;
`; `;
export type EditableDateProps = { export type EditableDateProps = {

View File

@ -1,6 +1,7 @@
export const animation = { export const animation = {
duration: { duration: {
instant: 0.1, instant: 0.075,
visible: 0.3, fast: 0.15,
normal: 0.3,
}, },
}; };

View File

@ -24,7 +24,7 @@ export const SortByName: Story = {
const sortButton = await canvas.findByText('Sort'); const sortButton = await canvas.findByText('Sort');
await userEvent.click(sortButton); await userEvent.click(sortButton);
const nameSortButton = canvas.getByText('Name', { selector: 'li' }); const nameSortButton = canvas.getByText('Name', { selector: 'li > div' });
await userEvent.click(nameSortButton); await userEvent.click(nameSortButton);
expect(await canvas.getByTestId('remove-icon-name')).toBeInTheDocument(); expect(await canvas.getByTestId('remove-icon-name')).toBeInTheDocument();

View File

@ -25,7 +25,7 @@ export const Email: Story = {
const sortButton = await canvas.findByText('Sort'); const sortButton = await canvas.findByText('Sort');
await userEvent.click(sortButton); await userEvent.click(sortButton);
const emailSortButton = canvas.getByText('Email', { selector: 'li' }); const emailSortButton = canvas.getByText('Email', { selector: 'li > div' });
await userEvent.click(emailSortButton); await userEvent.click(emailSortButton);
expect(await canvas.getByTestId('remove-icon-email')).toBeInTheDocument(); expect(await canvas.getByTestId('remove-icon-email')).toBeInTheDocument();
@ -45,7 +45,7 @@ export const Cancel: Story = {
const sortButton = await canvas.findByText('Sort'); const sortButton = await canvas.findByText('Sort');
await userEvent.click(sortButton); await userEvent.click(sortButton);
const emailSortButton = canvas.getByText('Email', { selector: 'li' }); const emailSortButton = canvas.getByText('Email', { selector: 'li > div' });
await userEvent.click(emailSortButton); await userEvent.click(emailSortButton);
expect(await canvas.getByTestId('remove-icon-email')).toBeInTheDocument(); expect(await canvas.getByTestId('remove-icon-email')).toBeInTheDocument();