Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-nav-preview): Moving Nav styling opinions to recomposed co…
…mponents (#31313)
- Loading branch information
Showing
28 changed files
with
130 additions
and
285 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-nav-preview-a222bbc3-7974-4785-9ccd-0c2960fcc82f.json
This file contains 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,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "feat: Moving styles to new recomposed components.", | ||
"packageName": "@fluentui/react-nav-preview", | ||
"email": "matejera@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
This file contains 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 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 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
12 changes: 4 additions & 8 deletions
12
...es/react-components/react-nav-preview/src/components/NavDrawerBody/NavDrawerBody.types.ts
This file contains 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 |
---|---|---|
@@ -1,17 +1,13 @@ | ||
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; | ||
import type { DrawerBodyProps, DrawerBodySlots, DrawerBodyState } from '@fluentui/react-drawer'; | ||
|
||
export type NavDrawerBodySlots = { | ||
root: Slot<'div'>; | ||
}; | ||
export type NavDrawerBodySlots = DrawerBodySlots; | ||
|
||
/** | ||
* NavDrawerBody Props | ||
*/ | ||
export type NavDrawerBodyProps = ComponentProps<NavDrawerBodySlots> & {}; | ||
export type NavDrawerBodyProps = DrawerBodyProps; | ||
|
||
/** | ||
* State used in rendering NavDrawerBody | ||
*/ | ||
export type NavDrawerBodyState = ComponentState<NavDrawerBodySlots>; | ||
// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from NavDrawerBodyProps. | ||
// & Required<Pick<NavDrawerBodyProps, 'propName'>> | ||
export type NavDrawerBodyState = DrawerBodyState; |
1 change: 0 additions & 1 deletion
1
packages/react-components/react-nav-preview/src/components/NavDrawerBody/index.ts
This file contains 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export * from './NavDrawerBody'; | ||
export * from './NavDrawerBody.types'; | ||
export * from './renderNavDrawerBody'; | ||
export * from './useNavDrawerBody'; | ||
export * from './useNavDrawerBodyStyles.styles'; |
15 changes: 0 additions & 15 deletions
15
...s/react-components/react-nav-preview/src/components/NavDrawerBody/renderNavDrawerBody.tsx
This file was deleted.
Oops, something went wrong.
This file contains 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
16 changes: 6 additions & 10 deletions
16
...omponents/react-nav-preview/src/components/NavDrawerBody/useNavDrawerBodyStyles.styles.ts
This file contains 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 |
---|---|---|
@@ -1,33 +1,29 @@ | ||
import { makeStyles, mergeClasses } from '@griffel/react'; | ||
import { makeStyles, mergeClasses, shorthands } from '@griffel/react'; | ||
import { tokens } from '@fluentui/react-theme'; | ||
import { useDrawerBodyStyles_unstable } from '@fluentui/react-drawer'; | ||
import type { SlotClassNames } from '@fluentui/react-utilities'; | ||
import type { NavDrawerBodySlots, NavDrawerBodyState } from './NavDrawerBody.types'; | ||
|
||
export const navDrawerBodyClassNames: SlotClassNames<NavDrawerBodySlots> = { | ||
root: 'fui-NavDrawerBody', | ||
// TODO: add class names for all slots on NavDrawerBodySlots. | ||
// Should be of the form `<slotName>: 'fui-NavDrawerBody__<slotName>` | ||
}; | ||
|
||
/** | ||
* Styles for the root slot | ||
*/ | ||
const useStyles = makeStyles({ | ||
root: { | ||
// TODO Add default styles for the root element | ||
...shorthands.padding(0, tokens.spacingVerticalMNudge), | ||
alignItems: 'unset', | ||
}, | ||
|
||
// TODO add additional classes for different states and/or slots | ||
}); | ||
|
||
/** | ||
* Apply styling to the NavDrawerBody slots based on the state | ||
*/ | ||
export const useNavDrawerBodyStyles_unstable = (state: NavDrawerBodyState): NavDrawerBodyState => { | ||
useDrawerBodyStyles_unstable(state); | ||
const styles = useStyles(); | ||
state.root.className = mergeClasses(navDrawerBodyClassNames.root, styles.root, state.root.className); | ||
|
||
// TODO Add class names to slots, for example: | ||
// state.mySlot.className = mergeClasses(styles.mySlot, state.mySlot.className); | ||
|
||
return state; | ||
}; |
This file contains 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
12 changes: 4 additions & 8 deletions
12
...eact-components/react-nav-preview/src/components/NavDrawerFooter/NavDrawerFooter.types.ts
This file contains 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 |
---|---|---|
@@ -1,17 +1,13 @@ | ||
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities'; | ||
import type { DrawerFooterProps, DrawerFooterSlots, DrawerFooterState } from '@fluentui/react-drawer'; | ||
|
||
export type NavDrawerFooterSlots = { | ||
root: Slot<'div'>; | ||
}; | ||
export type NavDrawerFooterSlots = DrawerFooterSlots; | ||
|
||
/** | ||
* NavDrawerFooter Props | ||
*/ | ||
export type NavDrawerFooterProps = ComponentProps<NavDrawerFooterSlots> & {}; | ||
export type NavDrawerFooterProps = DrawerFooterProps; | ||
|
||
/** | ||
* State used in rendering NavDrawerFooter | ||
*/ | ||
export type NavDrawerFooterState = ComponentState<NavDrawerFooterSlots>; | ||
// TODO: Remove semicolon from previous line, uncomment next line, and provide union of props to pick from NavDrawerFooterProps. | ||
// & Required<Pick<NavDrawerFooterProps, 'propName'>> | ||
export type NavDrawerFooterState = DrawerFooterState; |
1 change: 0 additions & 1 deletion
1
packages/react-components/react-nav-preview/src/components/NavDrawerFooter/index.ts
This file contains 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export * from './NavDrawerFooter'; | ||
export * from './NavDrawerFooter.types'; | ||
export * from './renderNavDrawerFooter'; | ||
export * from './useNavDrawerFooter'; | ||
export * from './useNavDrawerFooterStyles.styles'; |
15 changes: 0 additions & 15 deletions
15
...act-components/react-nav-preview/src/components/NavDrawerFooter/renderNavDrawerFooter.tsx
This file was deleted.
Oops, something went wrong.
This file contains 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.