Skip to content

Commit 68725a7

Browse files
committed
Hide empty ActionsMenu
1 parent ffb1a94 commit 68725a7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

explorer/components/DrawingPage/ActionsMenu.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@ import React from 'react'
22
import styled from 'styled-components'
33
import { navBarItemStyles } from './styles'
44

5+
type Action = {
6+
title: string
7+
onClick: () => void
8+
}
9+
510
export const ActionsMenu: React.FC = () => {
611
const [isActive, setIsActive] = React.useState(false)
712

13+
const actions: Action[] = []
14+
15+
if (!actions.length) return null
16+
817
return (
918
<Container title='More Actions' onClick={() => setIsActive(!isActive)}>
1019
<svg viewBox="0 0 24 24">
@@ -13,7 +22,9 @@ export const ActionsMenu: React.FC = () => {
1322
<circle cx="19" cy="12" r="2" />
1423
</svg>
1524
<Popup isActive={isActive}>
16-
<Item>No actions available</Item>
25+
{actions.map(action => (
26+
<Item><a onClick={action.onClick}>{action.title}</a></Item>
27+
))}
1728
</Popup>
1829
</Container>
1930
)

0 commit comments

Comments
 (0)