-
Notifications
You must be signed in to change notification settings - Fork 0
Fix handling of style property in Tabs component
#139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,10 +9,11 @@ import { Box } from "@/plugins/mui/Box"; | |
| import { isString } from "@/utils/isString"; | ||
| import { isComponentState } from "@/types/state/component"; | ||
|
|
||
| interface TabState { | ||
| interface TabState extends ComponentState { | ||
| type: "Tab"; | ||
| label?: string; | ||
| icon?: string; | ||
| iconPosition?: "bottom" | "end" | "start" | "top" | undefined; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we have |
||
| disabled?: boolean; | ||
| children?: ComponentProps[]; | ||
| } | ||
|
|
@@ -44,21 +45,23 @@ export function Tabs({ | |
| } | ||
| }; | ||
| return ( | ||
| <MuiBox sx={{ width: "100%" }}> | ||
| <MuiBox sx={{ width: "100%" }} style={style}> | ||
| <MuiBox sx={{ borderBottom: 1, borderColor: "divider" }}> | ||
| <MuiTabs id={id} style={style} value={value} onChange={handleChange}> | ||
| <MuiTabs id={id} value={value} onChange={handleChange}> | ||
| {tabItems?.map((tab, index) => { | ||
| const tabState = isComponentState(tab) | ||
| ? (tab as TabState) | ||
| : undefined; | ||
| return ( | ||
| <MuiTab | ||
| key={index} | ||
| style={tabState?.style} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we apply the same style to both the Tab button and body, was this a design decision? or does it needs discussion? |
||
| label={tabState ? tabState.label : isString(tab) ? tab : ""} | ||
| icon={ | ||
| tabState && | ||
| tabState.icon && <MuiIcon>{tabState.icon}</MuiIcon> | ||
| } | ||
| iconPosition={tabState?.iconPosition} | ||
| disabled={disabled || (tabState && tabState.disabled)} | ||
| /> | ||
| ); | ||
|
|
@@ -70,10 +73,11 @@ export function Tabs({ | |
| return ( | ||
| value === index && ( | ||
| <Box | ||
| style={tabState?.style} | ||
| key={index} | ||
| type={type} | ||
| onChange={onChange} | ||
| children={tabState?.children ?? undefined} | ||
| children={tabState?.children} | ||
| /> | ||
| ) | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| ## Version 0.1.8 (in development) | ||
|
|
||
| * Added `iconPosition` to `Tabs` Component. (#135) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here as well, please |
||
|
|
||
| ## Version 0.1.7 (from 2025/12/03) | ||
|
|
||
| * Updated dependencies | ||
|
|
@@ -11,10 +13,10 @@ | |
|
|
||
| ## Version 0.1.5 (from 2025/03/21) | ||
|
|
||
| * Add `multiple` property for `Select` component to enable the | ||
| * Added `multiple` property for `Select` component to enable the selection | ||
| of multiple elements. | ||
|
|
||
| * Add support for `Python 3.13` | ||
| * Added support for `Python 3.13` | ||
|
|
||
|
|
||
| ## Version 0.1.4 (from 2025/03/06) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR mentioned two issues, please mention them both here.