@@ -2,18 +2,22 @@ import React from 'react'
22import styled from 'styled-components'
33import { navBarItemStyles } from './styles'
44import { useCookies } from 'react-cookie'
5+ import { Drawing } from '../../types'
6+ import { AddTagModal } from './AddTagModal'
57
68type Action = {
79 title : string
810 onClick : ( ) => void
911}
1012
11- export const ActionsMenu : React . FC = ( ) => {
13+ export const ActionsMenu : React . FC < { drawing : Drawing } > = ( { drawing } ) => {
1214 const [ isActive , setIsActive ] = React . useState ( false )
1315 const [ cookies ] = useCookies ( [ 'feature__myTags' ] )
1416 const [ actions , setActions ] = React . useState < Action [ ] > ( [ ] )
17+ const [ isAddTagModalOpen , setIsAddTagModalOpen ] = React . useState ( false )
1518
16- const addNewTag = { title : 'Add new tag' , onClick : ( ) => alert ( 'add new tag' ) }
19+ const toggleAddTagModal = ( ) => setIsAddTagModalOpen ( ! isAddTagModalOpen )
20+ const addNewTag = { title : 'Add hashtags' , onClick : toggleAddTagModal }
1721
1822 React . useEffect ( ( ) => {
1923 const newActions = [ ]
@@ -22,18 +26,21 @@ export const ActionsMenu: React.FC = () => {
2226 } , [ cookies ] )
2327
2428 return (
25- < Container title = 'Actions' onClick = { ( ) => setIsActive ( ! isActive ) } isHidden = { ! actions . length } >
26- < svg viewBox = "0 0 24 24" >
27- < circle cx = "5" cy = "12" r = "2" />
28- < circle cx = "12" cy = "12" r = "2" />
29- < circle cx = "19" cy = "12" r = "2" />
30- </ svg >
31- < Popup isActive = { isActive } >
32- { actions . map ( action => (
33- < Item key = { action . title } > < a onClick = { action . onClick } > { action . title } </ a > </ Item >
34- ) ) }
35- </ Popup >
36- </ Container >
29+ < >
30+ < Container title = 'Actions' onClick = { ( ) => setIsActive ( ! isActive ) } isHidden = { ! actions . length } >
31+ < svg viewBox = "0 0 24 24" >
32+ < circle cx = "5" cy = "12" r = "2" />
33+ < circle cx = "12" cy = "12" r = "2" />
34+ < circle cx = "19" cy = "12" r = "2" />
35+ </ svg >
36+ < Popup isActive = { isActive } >
37+ { actions . map ( action => (
38+ < Item key = { action . title } > < a onClick = { action . onClick } > { action . title } </ a > </ Item >
39+ ) ) }
40+ </ Popup >
41+ </ Container >
42+ < AddTagModal drawing = { drawing } isOpen = { isAddTagModalOpen } closeModal = { toggleAddTagModal } />
43+ </ >
3744 )
3845}
3946
@@ -61,4 +68,6 @@ const Popup = styled.div.attrs({ className: 'Explorer__ActionsMenu__Popup'})<{ i
6168 width: 200px;
6269`
6370
64- const Item = styled . div . attrs ( { className : 'Explorer__ActionsMenu__Item' } ) ``
71+ const Item = styled . div . attrs ( { className : 'Explorer__ActionsMenu__Item' } ) `
72+ font-size: 24px;
73+ `
0 commit comments