Skip to content

Commit

Permalink
[Bug]: Tree, vertical spacing of branches and children is inconsistent (
Browse files Browse the repository at this point in the history
#28681)

* paddingtop nested tree

* change

* token

* Update change/@fluentui-react-tree-0b6932ba-9e9f-4bc9-9d59-4d8152ff0cfe.json

Co-authored-by: Bernardo Sunderhus <[email protected]>

* Update packages/react-components/react-tree/src/components/Tree/useTreeStyles.styles.ts

Co-authored-by: Bernardo Sunderhus <[email protected]>

* remove unused styles

* unused shortcuts

---------

Co-authored-by: petdud <[email protected]>
Co-authored-by: Bernardo Sunderhus <[email protected]>
  • Loading branch information
3 people authored Jul 31, 2023
1 parent f9e014b commit d4b3fee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "bugfix: Tree, vertical spacing of branches and children is inconsistent",
"packageName": "@fluentui/react-tree",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { makeStyles, mergeClasses } from '@griffel/react';
import type { SlotClassNames } from '@fluentui/react-utilities';
import { tokens } from '@fluentui/react-theme';
import { FlatTreeSlots, FlatTreeState } from './FlatTree.types';
Expand All @@ -13,20 +13,10 @@ const useStyles = makeStyles({
flexDirection: 'column',
rowGap: tokens.spacingVerticalXXS,
},
subtree: {
...shorthands.flex(1, 1, '100%'),
...shorthands.gridArea('subtree'),
},
});

export const useFlatTreeStyles_unstable = (state: FlatTreeState): FlatTreeState => {
const styles = useStyles();
const isSubTree = state.level > 0;
state.root.className = mergeClasses(
flatTreeClassNames.root,
styles.root,
isSubTree && styles.subtree,
state.root.className,
);
state.root.className = mergeClasses(flatTreeClassNames.root, styles.root, state.root.className);
return state;
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { makeStyles, mergeClasses } from '@griffel/react';
import type { TreeSlots, TreeState } from './Tree.types';
import type { SlotClassNames } from '@fluentui/react-utilities';
import { tokens } from '@fluentui/react-theme';
Expand All @@ -14,14 +14,14 @@ const useStyles = makeStyles({
rowGap: tokens.spacingVerticalXXS,
},
subtree: {
...shorthands.flex(1, 1, '100%'),
...shorthands.gridArea('subtree'),
paddingTop: tokens.spacingVerticalXXS,
},
});

export const useTreeStyles_unstable = (state: TreeState): TreeState => {
const styles = useStyles();
const isSubTree = state.level > 0;
const isSubTree = state.level > 1;

state.root.className = mergeClasses(
treeClassNames.root,
styles.root,
Expand Down

0 comments on commit d4b3fee

Please sign in to comment.