Skip to content

Commit

Permalink
Merge pull request #10 from poap-xyz/release/v1.1.3
Browse files Browse the repository at this point in the history
Release v1.1.3
  • Loading branch information
jm42 authored May 9, 2023
2 parents 37a616d + 80f256e commit 652372e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poap-family",
"version": "1.1.2",
"version": "1.1.3",
"author": {
"name": "POAP",
"url": "https://poap.xyz"
Expand Down
11 changes: 10 additions & 1 deletion src/app/Admin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useContext } from 'react'
import { useContext, useEffect } from 'react'
import { Outlet } from 'react-router-dom'
import { HTMLContext } from '../stores/html'
import { AdminContext } from '../stores/admin'
import CenterPage from '../components/CenterPage'
import Card from '../components/Card'
Expand All @@ -9,8 +10,16 @@ import Loading from '../components/Loading'
import ButtonLink from '../components/ButtonLink'

function Admin() {
const { setTitle } = useContext(HTMLContext)
const { authenticate, authenticated, passphrase, error, loading, reset } = useContext(AdminContext)

useEffect(
() => {
setTitle('Enter Admin Passphrase')
},
[setTitle]
)

if (!passphrase) {
return (
<CenterPage>
Expand Down
26 changes: 17 additions & 9 deletions src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ function MenuItem({
title,
href,
to,
children,
opened = false,
onClick = () => {},
onClick,
children,
...props
}) {
const navigate = useNavigate()
const [open, setOpen] = useState(opened)
Expand All @@ -20,9 +21,8 @@ function MenuItem({
if (children) {
setOpen((o) => !o)
}
onClick()
if (href) {
window.location.href = href
if (onClick) {
onClick()
}
if (to) {
navigate(to)
Expand All @@ -31,11 +31,19 @@ function MenuItem({

return (
<div className={`menu-item${open ? ' active' : ''}`}>
<button className="menu-button" onClick={handleClick}>
{href && !to && !onClick && !children ? (
<a href={href} className="menu-link" {...props}>
{icon
? <span className="menu-button-icon" title={title ?? label}>{icon}</span>
: <span className="menu-button-label" title={title}>{label}</span>}
</button>
? <span className="menu-link-icon" title={title ?? label}>{icon}</span>
: <span className="menu-link-label" title={title}>{label}</span>}
</a>
) : (
<button className="menu-button" onClick={handleClick} {...props}>
{icon
? <span className="menu-button-icon" title={title ?? label}>{icon}</span>
: <span className="menu-button-label" title={title}>{label}</span>}
</button>
)}
{children && (
<div className="menu-item-content" style={{ display: open ? 'block' : 'none' }}>
{children}
Expand Down
14 changes: 10 additions & 4 deletions src/styles/menu-item.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
margin-top: .2rem;
}

.menu-button {
.menu-button, .menu-link {
display: inline-block;
appearance: none;
outline: none;
background-color: #eee;
Expand All @@ -15,19 +16,24 @@
width: 2.1rem;
height: 2.1rem;
overflow: hidden;
font-size: 80%;
}

.menu-button:hover {
.menu-button, .menu-link {
color: black;
}

.menu-button:hover, .menu-link:hover {
background-color: white;
border-color: #5e58a5;
}

.menu-item.active .menu-button {
.menu-item.active .menu-button, .menu-item.active .menu-link {
color: white;
background: linear-gradient(85deg, #5e58a5 30%, #968cff 100%);
}

.menu-button-label {
.menu-button-label, .menu-link-label {
font-weight: 700;
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
}
Expand Down

0 comments on commit 652372e

Please sign in to comment.