Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions dist/index.cjs

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.cjs.map

This file was deleted.

2 changes: 0 additions & 2 deletions dist/index.modern.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.modern.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions dist/index.module.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.module.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions dist/index.umd.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.umd.js.map

This file was deleted.

24 changes: 21 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jasonrundell/react-mega-menu",
"version": "1.6.1",
"version": "1.7.2",
"author": "jasonrundell <[email protected]>",
"source": "./src/index.js",
"main": "lib/index.js",
Expand All @@ -9,10 +9,11 @@
"format": "prettier --write src/**/*.{js,jsx}"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"react": "^18.2.0",
"sass": "^1.54.5",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0"
"uuid": "^9.0.1"
},
"devDependencies": {
"@babel/cli": "^7.23.0",
Expand Down Expand Up @@ -50,6 +51,6 @@
"navigation",
"mega",
"menu",
"megamenu"
"mega menu"
]
}
9 changes: 1 addition & 8 deletions src/components/Hamburger.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})`
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledHamburger = styled.button`
border: none;
Expand Down
10 changes: 1 addition & 9 deletions src/components/Logo.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})` // Example breakpoint for 'large'. You can adjust this value.
// Add other breakpoints as needed
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledLogo = styled.img`
display: flex;
Expand Down
10 changes: 1 addition & 9 deletions src/components/MainList.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})` // Example breakpoint for 'large'. You can adjust this value.
// Add other breakpoints as needed
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledList = styled.ul`
position: absolute;
Expand Down
9 changes: 1 addition & 8 deletions src/components/MainNavItem.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})`
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledMainNavItem = styled.li`
list-style: none;
Expand Down
9 changes: 1 addition & 8 deletions src/components/MainNavItemLink.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})`
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledMainNavItemLink = styled.a`
width: 100%;
Expand Down
9 changes: 1 addition & 8 deletions src/components/MegaList.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})`
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledMegaList = styled.ul`
position: absolute;
Expand Down
9 changes: 1 addition & 8 deletions src/components/Nav.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})`
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledNav = styled.nav`
position: absolute;
Expand Down
10 changes: 1 addition & 9 deletions src/components/NavItem.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})`
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledNavItem = styled.li`
list-style: none;
Expand All @@ -34,7 +27,6 @@ const StyledNavItem = styled.li`
${({ isHeading }) =>
isHeading &&
`
font-weight: 700;
${respondTo('large')} {
display: none;
}
Expand Down
9 changes: 1 addition & 8 deletions src/components/NavItemLink.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})`
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StylesNavItemLink = styled.a`
width: 100%;
Expand Down
9 changes: 1 addition & 8 deletions src/components/NavList.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})`
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledNavList = styled.ul`
position: absolute;
Expand Down
10 changes: 1 addition & 9 deletions src/components/TopBar.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled from '@emotion/styled'
import { breakpoints as BreakPoints } from '../config/styles'

const respondTo = (breakpoint) => {
const breakpoints = {
large: `@media (min-width: ${BreakPoints.large['min-width']})` // Example breakpoint for 'large'. You can adjust this value.
// Add other breakpoints as needed
}
return breakpoints[breakpoint] || null
}
import { respondTo } from '../helpers/responsive'

const StyledTopBar = styled.div`
position: absolute;
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions src/helpers/a11y.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const click = (e) => {
const code = e.charCode || e.keyCode
if (code === 32 || code === 13) {
return true
}
}

export const escape = (e, resetMenus) => {
if (e.keyCode === 27) {
resetMenus()
}
}
Loading