Skip to content

Commit

Permalink
context menu gets a recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
lankaukk committed Feb 16, 2024
1 parent 8cc99f7 commit bd944f4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 26 deletions.
13 changes: 2 additions & 11 deletions utopia-remix/app/components/projectActionContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import { useFetcher } from '@remix-run/react'
import React from 'react'
import { useProjectsStore } from '../store'
import { contextMenuItem } from '../styles/contextMenuItem.css'
import { contextMenuDropdown, contextMenuItem } from '../styles/contextMenu.css'
import { colors } from '../styles/sprinkles.css'
import { ProjectWithoutContent } from '../types'
import { assertNever } from '../util/assertNever'
Expand Down Expand Up @@ -118,17 +118,8 @@ export const ProjectContextMenu = React.memo(({ project }: { project: ProjectWit
return (
<DropdownMenu.Portal>
<DropdownMenu.Content
className={contextMenuDropdown()}
style={{
background: 'white',
padding: 4,
boxShadow: '2px 3px 4px #00000030',
border: '1px solid #ccc',
borderRadius: 4,
display: 'flex',
flexDirection: 'column',
gap: 4,
minWidth: 170,
position: 'relative',
right: 75,
}}
sideOffset={5}
Expand Down
15 changes: 2 additions & 13 deletions utopia-remix/app/components/sortProjectsContextMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import React from 'react'
import { useState } from 'react'
import { useProjectsStore } from '../store'
import { contextMenuItem } from '../styles/contextMenuItem.css'
import { contextMenuDropdown, contextMenuItem } from '../styles/contextMenu.css'
import { colors } from '../styles/sprinkles.css'
import { CheckIcon } from '@radix-ui/react-icons'

Expand All @@ -15,18 +14,8 @@ export const SortingContextMenu = React.memo(() => {
return (
<DropdownMenu.Portal>
<DropdownMenu.Content
className={contextMenuDropdown()}
style={{
background: 'white',
color: 'black',
padding: 4,
boxShadow: '2px 3px 4px #00000030',
border: '1px solid #ccc',
borderRadius: 4,
display: 'flex',
flexDirection: 'column',
gap: 4,
minWidth: 170,
position: 'relative',
right: 30,
}}
sideOffset={5}
Expand Down
11 changes: 9 additions & 2 deletions utopia-remix/app/routes/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,14 @@ const ProjectsHeader = React.memo(({ projects }: { projects: ProjectWithoutConte
</div>
</div>

<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 10 }}>
<div
style={{
display: projects.length === 0 ? 'none' : 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: 10,
}}
>
<CategoryActions projects={projects} />
<DropdownMenu.Root>
<DropdownMenu.Trigger asChild>
Expand Down Expand Up @@ -392,7 +399,7 @@ const CategoryTrashActions = React.memo(({ projects }: { projects: ProjectWithou
return (
<>
<div
className={button({color: 'subtle'})}
className={button({ color: 'subtle' })}
onClick={handleEmptyTrash}
style={{ display: projects.length === 0 ? 'none' : 'block' }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,24 @@ export const contextMenuItem = recipe({
},
],
})

export const contextMenuDropdown = recipe({
base: [
sprinkles({
borderRadius: 'small',
background: 'white',
color: 'lightModeBlack'
}),
{

padding: 4,
boxShadow: '2px 3px 4px #00000030',
border: '1px solid #ccc',
display: 'flex',
flexDirection: 'column',
gap: 4,
minWidth: 170,
position: 'relative',
},
],
})

0 comments on commit bd944f4

Please sign in to comment.