payload-kanban-board
Version:
A kanban board plugin for Payload CMS
44 lines (43 loc) • 1.69 kB
JavaScript
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { getTranslation } from '@payloadcms/translations';
import { Button } from '@payloadcms/ui';
import { useTranslation } from 'react-i18next';
import './styles.scss';
const baseClass = 'kanban-view-header';
const WorkflowViewHeader = (props)=>{
const { pluralLabel, newDocumentURL, hasCreatePermission, isShowingWorkflow, onWorkflowViewSwitch } = props;
const { t, i18n } = useTranslation('general');
return /*#__PURE__*/ _jsxs("header", {
className: `${baseClass} ${isShowingWorkflow ? 'is-kanban-view' : ''}`,
children: [
/*#__PURE__*/ _jsxs("div", {
style: {
display: 'flex',
justifyContent: 'center',
gap: 2
},
children: [
/*#__PURE__*/ _jsx("h1", {
children: getTranslation(pluralLabel, i18n)
}),
hasCreatePermission && /*#__PURE__*/ _jsx(Button, {
buttonStyle: "pill",
to: newDocumentURL,
children: t('Create New')
})
]
}),
/*#__PURE__*/ _jsxs(Button, {
buttonStyle: "secondary",
onClick: ()=>onWorkflowViewSwitch(),
children: [
isShowingWorkflow && 'Switch to table view',
!isShowingWorkflow && 'Switch to kanban view'
]
})
]
});
};
export { WorkflowViewHeader };
//# sourceMappingURL=WorkflowViewHeader.js.map