Feat/hide board fields (#1271)
* Renamed AuthAutoRouter * Moved RecoilScope * Refactored old WithTopBarContainer to make it less transclusive * Created new add opportunity button and refactored DropdownButton * Added tests * Deactivated new eslint rule * Refactored Table options with new dropdown * Started BoardDropdown * Fix lint * Refactor dropdown openstate * Fix according to PR * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -0,0 +1,55 @@
|
||||
import { useState } from 'react';
|
||||
import { useTheme } from '@emotion/react';
|
||||
|
||||
import { DropdownMenuHeader } from '@/ui/dropdown/components/DropdownMenuHeader';
|
||||
import { DropdownMenuItem } from '@/ui/dropdown/components/DropdownMenuItem';
|
||||
import { StyledDropdownMenu } from '@/ui/dropdown/components/StyledDropdownMenu';
|
||||
import { StyledDropdownMenuItemsContainer } from '@/ui/dropdown/components/StyledDropdownMenuItemsContainer';
|
||||
import { StyledDropdownMenuSeparator } from '@/ui/dropdown/components/StyledDropdownMenuSeparator';
|
||||
import { IconChevronLeft } from '@/ui/icon';
|
||||
|
||||
type BoardOptionsDropdownMenu = 'options' | 'fields';
|
||||
|
||||
export function BoardOptionsDropdownContent() {
|
||||
const theme = useTheme();
|
||||
|
||||
const [menuShown, setMenuShown] =
|
||||
useState<BoardOptionsDropdownMenu>('options');
|
||||
|
||||
function handleFieldsClick() {
|
||||
setMenuShown('fields');
|
||||
}
|
||||
|
||||
function handleMenuHeaderClick() {
|
||||
setMenuShown('options');
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledDropdownMenu>
|
||||
{menuShown === 'options' ? (
|
||||
<>
|
||||
<DropdownMenuHeader>Options</DropdownMenuHeader>
|
||||
<StyledDropdownMenuSeparator />
|
||||
<StyledDropdownMenuItemsContainer>
|
||||
<DropdownMenuItem onClick={handleFieldsClick}>
|
||||
Fields
|
||||
</DropdownMenuItem>
|
||||
</StyledDropdownMenuItemsContainer>
|
||||
</>
|
||||
) : (
|
||||
menuShown === 'fields' && (
|
||||
<>
|
||||
<DropdownMenuHeader
|
||||
startIcon={<IconChevronLeft size={theme.icon.size.md} />}
|
||||
onClick={handleMenuHeaderClick}
|
||||
>
|
||||
Fields
|
||||
</DropdownMenuHeader>
|
||||
<StyledDropdownMenuSeparator />
|
||||
{}
|
||||
</>
|
||||
)
|
||||
)}
|
||||
</StyledDropdownMenu>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user