mirror of
https://github.com/mue/mue.git
synced 2026-07-16 21:44:22 +02:00
refactor: Convert pure components to functional components
Co-authored-by: David Ralph <me@davidcralph.co.uk> Co-authored-by: Isaac <contact@eartharoid.me>
This commit is contained in:
@@ -8,12 +8,15 @@ import {
|
||||
} from 'react-icons/md';
|
||||
import EventBus from 'utils/eventbus';
|
||||
import { Button } from 'components/Elements';
|
||||
import { useTab } from 'components/Elements/MainModal/backend/TabContext';
|
||||
|
||||
export const CustomActions = ({ children }) => {
|
||||
return children;
|
||||
};
|
||||
|
||||
function Header(props) {
|
||||
const { setSubSection, subSection } = useTab();
|
||||
|
||||
const [setting, setSetting] = useState(localStorage.getItem(props.setting) === 'true');
|
||||
|
||||
useEffect(() => {
|
||||
@@ -67,15 +70,17 @@ function Header(props) {
|
||||
return (
|
||||
<div className="modalHeader">
|
||||
<span className="mainTitle">
|
||||
{/*}
|
||||
{props.secondaryTitle && (
|
||||
<>
|
||||
<span className="backTitle" onClick={props.goBack}>
|
||||
<span className="backTitle" onClick={() => setSubSection('')}>
|
||||
{props.title}
|
||||
</span>
|
||||
<MdOutlineKeyboardArrowRight />
|
||||
</>
|
||||
)}
|
||||
{props.secondaryTitle || props.title}
|
||||
*/}
|
||||
</span>
|
||||
<div className="headerActions">
|
||||
{props.visibilityToggle && <VisibilityToggle />}
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
import { MdOutlineKeyboardArrowRight } from 'react-icons/md';
|
||||
import { useTab } from 'components/Elements/MainModal/backend/TabContext';
|
||||
import React from 'react';
|
||||
|
||||
function Section({ title, subtitle, icon, onClick, children }) {
|
||||
function Section({ id, title, subtitle, icon, onClick, children }) {
|
||||
const { setSubSection } = useTab();
|
||||
|
||||
const handleClick = () => {
|
||||
setSubSection(id);
|
||||
if (onClick) {
|
||||
onClick();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<div className="moreSettings" onClick={onClick}>
|
||||
<div className="moreSettings" onClick={handleClick}>
|
||||
<div className="left">
|
||||
{icon}
|
||||
<div className="content">
|
||||
|
||||
Reference in New Issue
Block a user