このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
kikikan/backend/resources/js/admin/side.jsx
2021-10-20 20:25:21 +09:00

68 行
3.0 KiB
JavaScript

import React, { useEffect, useState } from 'react';
import { Link } from 'react-router-dom'
export default function Side() {
const [selected, setSelected] = useState('');
const handleLogout = () => {
axios.get('/admin/logout')
.then(() => location.href = '/admin/login')
}
return (
<div className="l-side">
<div className="l-side-logo">
<a href=""><img src="/assets/img/common/logo.svg" alt="ロゴ" /></a>
</div>
<nav className="mypage-nav">
<ul className="mypage-nav-list">
<li
className={`mypage-nav-list__item ${(selected == 'meeting' || (selected == '' && document.getElementById('admin_router').value == 'meeting')) && "nav-active"}`}
onClick={e => {
e.preventDefault();
setSelected('meeting');
}}>
<Link className='mypage-nav-list__link' to='/admin/meeting'>
<i className="icon meeting"></i>
<span>ミーティング</span>
</Link>
</li>
<li className={`mypage-nav-list__item ${ (selected == 'child' || (selected == '' && document.getElementById('admin_router').value == 'child')) && "nav-active"}`}
onClick={e => {
e.preventDefault();
setSelected('child');
}}>
<Link className='mypage-nav-list__link' to='/admin/child'>
<i className="icon parents"></i>
<span>子情報</span>
</Link>
</li>
<li className={`mypage-nav-list__item ${ (selected == 'parent' || (selected == '' && document.getElementById('admin_router').value == 'parent')) && "nav-active"}`}
onClick={e => {
e.preventDefault();
setSelected('parent');
}}>
<Link className='mypage-nav-list__link' to='/admin/parent'>
<i className="icon parents"></i>
<span>親情報</span>
</Link>
</li>
<li className={`mypage-nav-list__item ${(selected == 'logout') && "nav-active"}`}
onClick={e => {
e.preventDefault();
setSelected('logout');
}}>
<a className="mypage-nav-list__link" onClick={handleLogout}>
<i className="icon log-out"></i><span></span>
</a>
</li>
</ul>
</nav>
</div>
);
}