Fix single note in grid (#2437)

- fix single note in grid
This commit is contained in:
brendanlaschke 2023-11-13 16:01:31 +01:00 committed by GitHub
parent 44d046b363
commit c7568ff28b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -11,7 +11,7 @@ import {
} from '@/ui/object/field/contexts/FieldContext';
import { Activity, ActivityTarget, Comment } from '~/generated/graphql';
const StyledCard = styled.div`
const StyledCard = styled.div<{ isSingleNote: boolean }>`
align-items: flex-start;
background: ${({ theme }) => theme.background.secondary};
border: 1px solid ${({ theme }) => theme.border.color.medium};
@ -20,6 +20,7 @@ const StyledCard = styled.div`
flex-direction: column;
height: 300px;
justify-content: space-between;
max-width: ${({ isSingleNote }) => (isSingleNote ? '300px' : 'unset')};
`;
const StyledCardDetailsContainer = styled.div`
@ -73,6 +74,7 @@ const StyledCommentIcon = styled.div`
export const NoteCard = ({
note,
isSingleNote,
}: {
note: Pick<
Activity,
@ -81,6 +83,7 @@ export const NoteCard = ({
activityTargets?: Array<Pick<ActivityTarget, 'id'>> | null;
comments?: Array<Pick<Comment, 'id'>> | null;
};
isSingleNote: boolean;
}) => {
const theme = useTheme();
const openActivityRightDrawer = useOpenActivityRightDrawer();
@ -95,7 +98,7 @@ export const NoteCard = ({
return (
<FieldContext.Provider value={fieldContext as GenericFieldContextType}>
<StyledCard>
<StyledCard isSingleNote={isSingleNote}>
<StyledCardDetailsContainer
onClick={() => openActivityRightDrawer(note.id)}
>

View File

@ -59,7 +59,11 @@ export const NoteList = ({ title, notes, button }: NoteListProps) => (
</StyledTitleBar>
<StyledNoteContainer>
{notes.map((note) => (
<NoteCard key={note.id} note={note} />
<NoteCard
key={note.id}
note={note}
isSingleNote={notes.length == 1}
/>
))}
</StyledNoteContainer>
</StyledContainer>