Skip to content

Commit

Permalink
fix: remove merge-duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
lightlii committed Jul 27, 2023
1 parent 2ea6977 commit 5c1ac88
Showing 1 changed file with 25 additions and 31 deletions.
56 changes: 25 additions & 31 deletions src/renderer/components/SettingsView/SettingsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,27 @@ export const SettingsMenu = ({ tabs, currentTab, onTabChange }) => {
height: '100vh',
borderRadius: 0,
zIndex: 1,
position: 'relative',
position: 'relative'
}}
>
<StyledTabs
orientation='vertical'
value={currentTab}
onChange={(e, newValue) => onTabChange(newValue)}
>
{
tabs.map(tab => (
<Tab
disableRipple
orientation='vertical'
key={tab.tabId}
value={tab.tabId}
component={RenderTab}
tab={tab}
active={tab.tabId === currentTab}
/>
))
}
</StyledTabs >
</Paper >
{tabs.map(tab => (
<Tab
disableRipple
orientation='vertical'
key={tab.tabId}
value={tab.tabId}
component={RenderTab}
tab={tab}
active={tab.tabId === currentTab}
/>
))}
</StyledTabs>
</Paper>
)
}

Expand All @@ -62,21 +60,17 @@ export const SettingsMenu = ({ tabs, currentTab, onTabChange }) => {
* @prop {(e: React.Dispatch<number>) => number} onTabChange
*/
/** @param {RenderTabProps} props */
export const RenderTab = React.forwardRef(({ tab: { icon, label, subtitle, type }, ...rest }, ref) => (
<SettingsItem icon={icon} label={label} subtitle={subtitle} type={type || 'menuItem'} {...rest} />
))

const StyledTabs = styled(Tabs)`
height: 100vh;
padding-top: 1em;
& .MuiTabs-indicator {
display: none;
}
& .MuiTab-root {
max-width: 100%;
}
`
export const RenderTab = React.forwardRef(
({ tab: { icon, label, subtitle, type }, ...rest }, ref) => (
<SettingsItem
icon={icon}
label={label}
subtitle={subtitle}
type={type || 'menuItem'}
{...rest}
/>
)
)

const StyledTabs = styled(Tabs)`
height: 100vh;
Expand Down

0 comments on commit 5c1ac88

Please sign in to comment.