Skip to content
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

More SideNav, shadowDom improvements #2351

Merged
merged 8 commits into from
Sep 12, 2024

Conversation

benschell-okta
Copy link
Contributor

@benschell-okta benschell-okta commented Sep 12, 2024

OKTA-798189

Summary

  • Adds the ability to pass a footer component instead of footerItems!
  • Adds border above the SideNav footer and below the SideNav header only in certain cases (the header only if the nav content has scrolled at all; the footer only if the nav content is scrollable at all)
  • [temporary] Adds logo area to the SideNav, loosely styled and using a fallback / default logo of the Okta SVG from Admin (this likely needs to change)
  • Moves TopNav height to a separate constants file so that SideNav can use the same height for it's logo section
  • Improves height settings on generated elements in ScopedCssBaseline AND createShadowDomElements to allow the consumer to achieve the results they want

This will require followup work when the Logo portion of the SideNav spec is complete, but I'd like to get this current state in to allow for future iteration.

Testing & Screenshots

  • I have confirmed this change with my designer and the Odyssey Design Team.

@benschell-okta benschell-okta requested a review from a team as a code owner September 12, 2024 13:31
@@ -60,7 +64,8 @@ const OdysseyProvider = <SupportedLanguages extends string>({
shadowRootElement={shadowRootElement || shadowDomElement}
themeOverride={themeOverride}
>
<ScopedCssBaseline>
{/* This component creates a div; for flexibility of layout of children, make it inherit its parent's height */}
<ScopedCssBaseline sx={scopedCssBaselineStyles}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've discussed this with @KevinGhadyani-Okta and the need to allow this to respect its parent's wishes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -21,6 +21,9 @@ export const createShadowDomElements = (containerElement: HTMLElement) => {
// React app root component.
const shadowRootElement = document.createElement("div");
shadowRootElement.setAttribute("id", "shadow-root");
// This div could cause issues with layout of children.
// For flexibility, make it inherit its parent's height
shadowRootElement.style.setProperty("height", "inherit");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: I've discussed this with @KevinGhadyani-Okta and the need to allow this to respect its parent's wishes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely this is temporary; it's copied wholesale (with formatting changes) from the existing Admin impl. @KevinGhadyani-Okta agreed we should have some kind of fallback, but I'd anticipate this changes as Design finalizes the Logo portion of the SideNav spec

Comment on lines 310 to 318
const sideNavStyles = useMemo(
() => ({
display: "flex",
height: "100vh",
height: "100%",
maxWidth: expandedWidth,
overflow: "hidden",
}),
[],
[expandedWidth],
);
Copy link
Contributor

@KevinGhadyani-Okta KevinGhadyani-Okta Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a mix of styled components and Box styles. Is it possible we could use only styled components the whole way? Those components can take props, so you'd pass these in as props rather than as a style object. Should make it so we don't have two ways of styling components in here.

This is time-pending. It's a big change, and I don't like asking for it last-minute. If you have time, it'd be nice to unify where styles are located.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't like that there was a mix and was converting to styled when it seemed to make sense. If you're open to this ballooning, I can convert all of them

}

// Determine if the scrollable container has overflow or not on load
updateIsContentScrollable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@KevinGhadyani-Okta KevinGhadyani-Okta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, but I know you're making some other changes. Just marking that "Kevin said this was good at some point".

@oktapp-aperture-okta oktapp-aperture-okta bot merged commit 2231f9c into main Sep 12, 2024
3 checks passed
@oktapp-aperture-okta oktapp-aperture-okta bot deleted the bs-OKTA-798189-more-sidenav-improvements branch September 12, 2024 21:04
bryancunningham-okta pushed a commit that referenced this pull request Sep 17, 2024
OKTA-798189 feat: side nav improvements
feat: side nav, shadow dom improvements
fix: revert constant testing
fix: cleanup
fix: pr comments
fix: more pr comments
fix: convert boxes to styled components
fix: test fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants