-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[Fluent] Update NME to use fluent accordion for both nodeList and properties pane #16847
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5005b78
remove useDegrees from syncedslider, fix dropdown to properly handle …
3e5a8d5
move the notion of degrees outside of vector3
322f066
Merge branch 'BabylonJS:master' into master
georginahalpern 584e0d5
pr comments
2a84c20
Merge branch 'BabylonJS:master' into master
georginahalpern a1f736d
Merge branch 'BabylonJS:master' into master
georginahalpern 885f533
Merge branch 'BabylonJS:master' into master
georginahalpern ec4534a
Merge branch 'BabylonJS:master' into master
georginahalpern 8f4721a
in progress
4c24bb3
Merge branch 'master' of https://github.com/georginahalpern/Babylon.j…
c6c6095
merge
0d9341f
update propertytabs to use fluent accordion
be36204
merge masteR
0d3c61a
nit
0320ce5
fix build
1a097cb
rename getter to be clear that its a function, pr comments
60292fd
input properties getter made into a function
c637aba
input forwardref
b0d1112
remove custom input styling and use fluent searchbox
d5676ae
remove style change to split container
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/dev/sharedUiComponents/src/components/propertyTabComponentBase.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useContext } from "react"; | ||
import type { FunctionComponent, PropsWithChildren } from "react"; | ||
import { ToolContext } from "../fluent/hoc/fluentToolWrapper"; | ||
import { Pane } from "../fluent/hoc/pane"; | ||
import { Accordion } from "../fluent/primitives/accordion"; | ||
|
||
/** | ||
* A wrapper component for the property tab that provides a consistent layout and styling. | ||
* It uses a Pane and an Accordion to organize the content, so its direct children | ||
* must have 'title' props to be compatible with the Accordion structure. | ||
* @param props The props to pass to the component. | ||
* @returns The rendered component. | ||
*/ | ||
export const PropertyTabComponentBase: FunctionComponent<PropsWithChildren> = (props) => { | ||
const context = useContext(ToolContext); | ||
const fluentWrapper: FunctionComponent<PropsWithChildren> = (props) => { | ||
return ( | ||
<Pane title={context.toolName}> | ||
<Accordion>{props.children}</Accordion> | ||
</Pane> | ||
); | ||
}; | ||
const originalWrapper: FunctionComponent<PropsWithChildren> = (props) => { | ||
return ( | ||
<div id="propertyTab"> | ||
<div id="header"> | ||
<img id="logo" src="https://www.babylonjs.com/Assets/logo-babylonjs-social-twitter.png" /> | ||
<div id="title">{context.toolName}</div> | ||
</div> | ||
<div>{props.children}</div> | ||
</div> | ||
); | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
const Wrapper = context.useFluent ? fluentWrapper : originalWrapper; | ||
return <Wrapper>{props.children}</Wrapper>; | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Body1Strong, makeStyles, tokens } from "@fluentui/react-components"; | ||
import type { FluentIcon } from "@fluentui/react-icons"; | ||
import type { FunctionComponent, PropsWithChildren } from "react"; | ||
|
||
const useStyles = makeStyles({ | ||
rootDiv: { | ||
flex: 1, | ||
overflow: "hidden", | ||
display: "flex", | ||
flexDirection: "column", | ||
}, | ||
icon: { | ||
width: tokens.fontSizeBase400, | ||
height: tokens.fontSizeBase400, | ||
verticalAlign: "middle", | ||
}, | ||
header: { | ||
height: tokens.fontSizeBase400, | ||
fontSize: tokens.fontSizeBase400, | ||
textAlign: "center", | ||
verticalAlign: "middle", | ||
}, | ||
}); | ||
|
||
export type PaneProps = { | ||
title: string; | ||
icon?: FluentIcon; | ||
}; | ||
export const Pane: FunctionComponent<PropsWithChildren<PaneProps>> = (props) => { | ||
const classes = useStyles(); | ||
return ( | ||
<div className={classes.rootDiv}> | ||
<div className={classes.header}> | ||
{props.icon ? ( | ||
<props.icon className={classes.icon} /> | ||
) : ( | ||
<img className={classes.icon} id="logo" src="https://www.babylonjs.com/Assets/logo-babylonjs-social-twitter.png" /> | ||
)} | ||
<Body1Strong id="title">{props.title}</Body1Strong> | ||
</div> | ||
{props.children} | ||
</div> | ||
); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/dev/sharedUiComponents/src/fluent/primitives/searchBox.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Field, SearchBox as FluentSearchBox, makeStyles } from "@fluentui/react-components"; | ||
import type { InputOnChangeData } from "@fluentui/react-components"; | ||
import type { SearchBoxChangeEvent } from "@fluentui/react-components"; | ||
|
||
type SearchProps = { | ||
onChange: (val: string) => void; | ||
placeholder?: string; | ||
}; | ||
const useStyles = makeStyles({ | ||
search: { | ||
minWidth: "50px", | ||
}, | ||
}); | ||
export const SearchBox = (props: SearchProps) => { | ||
const classes = useStyles(); | ||
const onChange: (ev: SearchBoxChangeEvent, data: InputOnChangeData) => void = (_, data) => { | ||
props.onChange(data.value); | ||
}; | ||
|
||
return ( | ||
<Field> | ||
<FluentSearchBox className={classes.search} placeholder={props.placeholder} onChange={onChange} /> | ||
</Field> | ||
); | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.