You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import Router from 'next/router'
|
|
|
|
import Head from 'next/head'
|
|
|
|
import {Button} from '@rmwc/button'
|
|
|
|
import styles from './actionBar.module.css'
|
|
|
|
|
|
|
|
export default function AdminActionBar({title, actions, children}) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Head>
|
|
|
|
<title>SoS Admin | {title}</title>
|
|
|
|
</Head>
|
|
|
|
<div className={styles.actionBar}>
|
|
|
|
<h2>{title}</h2>
|
|
|
|
{actions && Array.isArray(actions) && actions.map((action, index) => {
|
|
|
|
if(action.url)
|
|
|
|
return <Button key={index} outlined onClick={()=>Router.push(action.url)}>{action.label}</Button>
|
|
|
|
if(action.onClick)
|
|
|
|
return <Button key={index} outlined onClick={action.onClick}>{action.label}</Button>
|
|
|
|
return <Button key={index} outlined>{action.label}</Button>
|
|
|
|
})}
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|