Update UI to Match Figma Specs: Labels, Buttons, Gaps (#6415)
@Bonapara Done with issue #5910  --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,16 +1,15 @@
|
|||||||
import React from 'react';
|
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
const StyledGroup = styled.div`
|
const StyledGroup = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
font-size: ${({ theme }) => theme.font.size.xs};
|
font-size: ${({ theme }) => theme.font.size.xs};
|
||||||
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
font-weight: ${({ theme }) => theme.font.weight.semiBold};
|
||||||
padding-bottom: ${({ theme }) => theme.spacing(2)};
|
padding-bottom: ${({ theme }) => theme.spacing(1)};
|
||||||
padding-left: ${({ theme }) => theme.spacing(2)};
|
padding-left: ${({ theme }) => theme.spacing(2)};
|
||||||
padding-right: ${({ theme }) => theme.spacing(1)};
|
padding-right: ${({ theme }) => theme.spacing(1)};
|
||||||
padding-top: ${({ theme }) => theme.spacing(2)};
|
padding-top: ${({ theme }) => theme.spacing(2)};
|
||||||
text-transform: uppercase;
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { isNonEmptyString } from '@sniptt/guards';
|
|||||||
import { useMemo, useRef } from 'react';
|
import { useMemo, useRef } from 'react';
|
||||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
|
import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
|
||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
import { Avatar, IconNotes, IconSparkles } from 'twenty-ui';
|
import { Avatar, IconNotes, IconSparkles, IconX } from 'twenty-ui';
|
||||||
|
|
||||||
import { useOpenCopilotRightDrawer } from '@/activities/copilot/right-drawer/hooks/useOpenCopilotRightDrawer';
|
import { useOpenCopilotRightDrawer } from '@/activities/copilot/right-drawer/hooks/useOpenCopilotRightDrawer';
|
||||||
import { copilotQueryState } from '@/activities/copilot/right-drawer/states/copilotQueryState';
|
import { copilotQueryState } from '@/activities/copilot/right-drawer/states/copilotQueryState';
|
||||||
@ -33,10 +33,11 @@ import { commandMenuCommandsState } from '../states/commandMenuCommandsState';
|
|||||||
import { isCommandMenuOpenedState } from '../states/isCommandMenuOpenedState';
|
import { isCommandMenuOpenedState } from '../states/isCommandMenuOpenedState';
|
||||||
import { Command, CommandType } from '../types/Command';
|
import { Command, CommandType } from '../types/Command';
|
||||||
|
|
||||||
|
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
|
||||||
import { CommandGroup } from './CommandGroup';
|
import { CommandGroup } from './CommandGroup';
|
||||||
import { CommandMenuItem } from './CommandMenuItem';
|
import { CommandMenuItem } from './CommandMenuItem';
|
||||||
|
|
||||||
export const StyledDialog = styled.div`
|
const StyledCommandMenu = styled.div`
|
||||||
background: ${({ theme }) => theme.background.secondary};
|
background: ${({ theme }) => theme.background.secondary};
|
||||||
border-left: 1px solid ${({ theme }) => theme.border.color.medium};
|
border-left: 1px solid ${({ theme }) => theme.border.color.medium};
|
||||||
box-shadow: ${({ theme }) => theme.boxShadow.strong};
|
box-shadow: ${({ theme }) => theme.boxShadow.strong};
|
||||||
@ -51,48 +52,63 @@ export const StyledDialog = styled.div`
|
|||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const StyledInput = styled.input`
|
const StyledInputContainer = styled.div`
|
||||||
background: ${({ theme }) => theme.background.secondary};
|
align-items: center;
|
||||||
|
background-color: ${({ theme }) => theme.background.transparent.lighter};
|
||||||
border: none;
|
border: none;
|
||||||
border-bottom: 1px solid ${({ theme }) => theme.border.color.medium};
|
border-bottom: 1px solid ${({ theme }) => theme.border.color.medium};
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
color: ${({ theme }) => theme.font.color.primary};
|
|
||||||
|
display: flex;
|
||||||
font-size: ${({ theme }) => theme.font.size.lg};
|
font-size: ${({ theme }) => theme.font.size.lg};
|
||||||
|
height: 56px;
|
||||||
|
margin: 0;
|
||||||
|
outline: none;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
padding: 0 ${({ theme }) => theme.spacing(3)};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledInput = styled.input`
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
background-color: transparent;
|
||||||
|
color: ${({ theme }) => theme.font.color.primary};
|
||||||
|
font-size: ${({ theme }) => theme.font.size.md};
|
||||||
margin: 0;
|
margin: 0;
|
||||||
outline: none;
|
outline: none;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
padding: ${({ theme }) => theme.spacing(4)};
|
padding: 0;
|
||||||
width: ${({ theme }) => `calc(100% - ${theme.spacing(10)})`};
|
width: ${({ theme }) => `calc(100% - ${theme.spacing(8)})`};
|
||||||
|
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
|
font-weight: ${({ theme }) => theme.font.weight.medium};
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledCancelText = styled.span`
|
const StyledCloseButtonContainer = styled.div`
|
||||||
color: ${({ theme }) => theme.font.color.tertiary};
|
align-items: center;
|
||||||
font-size: ${({ theme }) => theme.font.size.sm};
|
display: flex;
|
||||||
margin-right: 12px;
|
height: 32px;
|
||||||
margin-top: 6px;
|
justify-content: center;
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
top: 0;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const StyledList = styled.div`
|
const StyledList = styled.div`
|
||||||
background: ${({ theme }) => theme.background.secondary};
|
background: ${({ theme }) => theme.background.secondary};
|
||||||
overscroll-behavior: contain;
|
overscroll-behavior: contain;
|
||||||
transition: 100ms ease;
|
transition: 100ms ease;
|
||||||
transition-property: height;
|
transition-property: height;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const StyledInnerList = styled.div`
|
const StyledInnerList = styled.div`
|
||||||
padding-left: ${({ theme }) => theme.spacing(1)};
|
padding-left: ${({ theme }) => theme.spacing(2)};
|
||||||
padding-right: ${({ theme }) => theme.spacing(1)};
|
padding-right: ${({ theme }) => theme.spacing(2)};
|
||||||
width: calc(100% - ${({ theme }) => theme.spacing(2)});
|
padding-top: ${({ theme }) => theme.spacing(1)};
|
||||||
|
width: calc(100% - ${({ theme }) => theme.spacing(4)});
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const StyledEmpty = styled.div`
|
const StyledEmpty = styled.div`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: ${({ theme }) => theme.font.color.light};
|
color: ${({ theme }) => theme.font.color.light};
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -280,14 +296,25 @@ export const CommandMenu = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isCommandMenuOpened && (
|
{isCommandMenuOpened && (
|
||||||
<StyledDialog ref={commandMenuRef}>
|
<StyledCommandMenu ref={commandMenuRef}>
|
||||||
<StyledInput
|
<StyledInputContainer>
|
||||||
autoFocus
|
<StyledInput
|
||||||
value={commandMenuSearch}
|
autoFocus
|
||||||
placeholder="Search"
|
value={commandMenuSearch}
|
||||||
onChange={handleSearchChange}
|
placeholder="Search"
|
||||||
/>
|
onChange={handleSearchChange}
|
||||||
{!isMobile && <StyledCancelText>Esc to cancel</StyledCancelText>}
|
/>
|
||||||
|
{!isMobile && (
|
||||||
|
<StyledCloseButtonContainer>
|
||||||
|
<LightIconButton
|
||||||
|
accent={'tertiary'}
|
||||||
|
size={'medium'}
|
||||||
|
Icon={IconX}
|
||||||
|
onClick={closeCommandMenu}
|
||||||
|
/>
|
||||||
|
</StyledCloseButtonContainer>
|
||||||
|
)}
|
||||||
|
</StyledInputContainer>
|
||||||
<StyledList>
|
<StyledList>
|
||||||
<ScrollWrapper>
|
<ScrollWrapper>
|
||||||
<StyledInnerList>
|
<StyledInnerList>
|
||||||
@ -427,7 +454,7 @@ export const CommandMenu = () => {
|
|||||||
</StyledInnerList>
|
</StyledInnerList>
|
||||||
</ScrollWrapper>
|
</ScrollWrapper>
|
||||||
</StyledList>
|
</StyledList>
|
||||||
</StyledDialog>
|
</StyledCommandMenu>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user