Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

semantics ui complete responsive menu

import React, { useState } from 'react';
import { Menu, Responsive, Dropdown, DropdownMenu } from 'semantic-ui-react';
import { withRouter } from 'react-router-dom';
import LogoutModal from './LogoutModal';

function NavMenu(props) {
    const [activeItem, setActiveItem] = useState('Laptop Item')
    const [showModal, setShowModal] = useState(false)


    return (
        <div>
            <Menu pointing secondary>
                <Responsive as={Menu.Item} minWidth={790}
                    name='Laptop Item'
                    active={activeItem === 'Laptop Item'}
                    onClick={() => setActiveItem('Test Item')}
                />
                <Responsive as={Menu.Item} minWidth={790}
                    name='Laptop Item 2'
                    active={activeItem === 'Laptop Item 2'}
                    onClick={() => setActiveItem('Test Item 2')}
                />
                <Responsive as={Menu.Item} minWidth={790}
                    name='Laptop Item 3'
                    active={activeItem === 'Laptop Item 3'}
                    onClick={() => setActiveItem('Test Item 3')}
                />
                <Menu.Menu position = 'right'>
                    <Responsive as ={Menu.Item} minWidth={790}
                        name = "Sign Out"
                        onClick={() => setShowModal(true)}
                    />
                </Menu.Menu>
                <Responsive as ={Menu.Menu} maxWidth={789}  position='right'>
                    <Dropdown
                        item
                        icon ='bars'
                        >
                        <Dropdown.Menu>
                            <Dropdown.Item text='Mobile/Tablet Item 1'/>
                            <Dropdown.Item text='Mobile/Tablet Item 2'/>
                            <Dropdown.Item text='Mobile/Tablet Item 3'/>
                            <Dropdown.Item text='Sign Out'/>
                        </Dropdown.Menu>
                    </Dropdown>
                </Responsive>
            </Menu>
        </div>
    )
}

export default withRouter(NavMenu);
Comment

PREVIOUS NEXT
Code Example
Javascript :: fetch and edit jsonplaceholder api 
Javascript :: datetime knex 
Javascript :: how to remove duplicate array object in javascript 
Javascript :: Without using a new array or the reverse() method to Reverse an Array 
Javascript :: check date in between two dates nodejs 
Javascript :: REACT-ICONS reduce thickness 
Javascript :: Factorial multiplication in javascript 
Javascript :: js getelementbyid 
Javascript :: Javascript how to compare three numbers 
Javascript :: using index of on array of objects 
Javascript :: aos animation angular 
Javascript :: convert json object to array javascript 
Javascript :: javascript .fill 
Javascript :: gsap js link 
Javascript :: javascript disable resize window 
Javascript :: genius api 
Javascript :: javascript ajax load html into div 
Javascript :: diff two arrays javascript 
Javascript :: remove a user from a reaction discord.js 
Javascript :: convert time string in javascript 
Javascript :: js remove seconds from time 
Javascript :: dynamically change css class with javascript 
Javascript :: javascript array push middle 
Javascript :: vs code open file in new window 
Javascript :: string includes substring javascript 
Javascript :: svg to string javascript 
Javascript :: text inside an image component react native 
Javascript :: react native svg onpress 
Javascript :: last element in array 
Javascript :: javascript token generator 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =