mirror of
https://github.com/mue/mue.git
synced 2026-07-23 00:37:27 +02:00
refactor(welcome): Improve readability of sections
This commit is contained in:
@@ -1,22 +1,26 @@
|
||||
import { memo } from 'react';
|
||||
|
||||
function ProgressBar({ count, currentTab, switchTab }) {
|
||||
const Step = memo(({ isActive, index, onClick }) => {
|
||||
const className = isActive ? 'step active' : 'step';
|
||||
|
||||
return (
|
||||
<div className={className} onClick={onClick}>
|
||||
<span>{index + 1}</span>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
function ProgressBar({ numberOfTabs, currentTab, switchTab }) {
|
||||
return (
|
||||
<div className="progressbar">
|
||||
{count.map((num) => {
|
||||
let className = 'step';
|
||||
|
||||
const index = count.indexOf(num);
|
||||
if (index === currentTab) {
|
||||
className = 'step active';
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={className} key={index} onClick={() => switchTab(index)}>
|
||||
<span>{index + 1}</span>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{Array.from({ length: numberOfTabs }, (_, index) => (
|
||||
<Step
|
||||
key={index}
|
||||
isActive={index === currentTab}
|
||||
index={index}
|
||||
onClick={() => switchTab(index)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
const Content = ({ children }) => {
|
||||
return (
|
||||
<div className="content">{children}</div>
|
||||
)
|
||||
}
|
||||
|
||||
export { Content as default, Content };
|
||||
@@ -1,12 +1,6 @@
|
||||
const Panel = ({ children, type }) => (
|
||||
<section className={type}>
|
||||
{type === 'content' ? (
|
||||
<div className="content">{children}</div>
|
||||
) : type === 'aside' ? (
|
||||
<>{children}</>
|
||||
) : (
|
||||
children
|
||||
)}
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './Wrapper';
|
||||
export * from './Panel';
|
||||
export * from './Header';
|
||||
export * from './Header';
|
||||
export * from './Content';
|
||||
Reference in New Issue
Block a user