-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: adds app switcher lab component #2416
base: main
Are you sure you want to change the base?
Conversation
import { memo } from "react"; | ||
|
||
const OktaAuraSvgComponent = styled("svg")(() => ({ |
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.
Copied over from the other PR
@bryancunningham-okta #2415 (comment)
@michaeltamaki-okta I think we can use the svg that currently lives in the
SideNav
folder. We can just wrap it in a styled component and apply these sizes to it. Rather than duplicate the SVG with a different size.
The SVG in the SideNav
folder isn't being used (at least as far as I can tell), so I actually moved it to the NavRail
folder here.
}), | ||
); | ||
|
||
const NavRailAppImgComponent = styled("img")(() => ({ |
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.
Copied from the other PR @bryancunningham-okta #2415 (comment)
IMHO, It would be great if we could render the SVGs inline, rather than using images here
The plan is to load the SVGs from monolith/CDN (https://github.com/atko-eng/okta-ui/pull/8012 https://github.com/atko-eng/okta-core/pull/103856). The pros of this approach is that any app icon changes/additions/removals don't require an Odyssey version bump since it all comes from the backend. The downside is that we can't do inline SVGs like you suggested.
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.
Added notes from meeting with @KevinGhadyani-Okta
const renderAppIconLink = useCallback( | ||
(muiProps: MuiPropsContextType) => { | ||
return ( | ||
<NavRailAppLinkComponent |
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.
Add aria-current
> | ||
<OktaAura /> | ||
</NavRailOktaAuraWrapperComponent> | ||
{appIcons.map((appIcon) => ( |
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.
Add nav
(Add to the NavRail wrapper), ul
(Add a wrapper over all the apps), li
(Add to NavRailApp component)
shouldForwardProp: (prop) => prop !== "odysseyDesignTokens", | ||
})(({ odysseyDesignTokens }: { odysseyDesignTokens: DesignTokens }) => ({ | ||
width: "100%", | ||
height: NAV_RAIL_WIDTH, |
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.
See if we can import a shared value between top nav
const APP_SIDE_LENGTH = "36px"; | ||
const APP_ICON_SIDE_LENGTH = "32px"; |
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.
Change to rem
const NAV_RAIL_WIDTH = "64px"; | ||
|
||
export type NavRailProps = { | ||
appIcons?: Omit<NavRailAppProps, "selectedAppName">[]; |
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.
Prefer using Pick
instead of Omit
(muiProps: MuiPropsContextType) => { | ||
return ( |
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.
implicit return
> | ||
<NavRailAppImgComponent | ||
src={isSelected ? appIconSelectedUrl : appIconDefaultUrl} | ||
alt="" // Tell screen reader to ignore the image; the Tooltip describes the link |
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.
role=presentation
|
||
const NAV_RAIL_WIDTH = "64px"; | ||
|
||
export type NavRailProps = { |
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.
Add visibilityState = invisible | loading | loaded
How should we handle the loading state?
Skeleton
- Enduser: Skeleton shows, then disappears (pop in during load)
- Admin: Skeleton shows, then gets populated
No Skeleton ✅
- Enduser: Skeleton does not show, then disappears
- Admin: Skeleton does not show, then nav rail pops in
- Could we mitigate this via storing in local storage to prevent pop in? Would pop in the first load, but would not pop in after that.
- Also consider that this is just for the MVP where it is only shown for the admin. In the future, when it is shown to all users, we could switch to skeleton.
Full screen loading screen (prevents pop in)
- Would block showing the app until we get the data. Unacceptable to downstream teams.
Keep side nav the same width regardless of app switcher
- No, would break design assumptions
play: async ({ canvasElement, step }: PlaywrightProps<NavRailProps>) => { | ||
const canvas = within(canvasElement); | ||
|
||
await step("Nav rail successfully loads", async () => { |
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.
shows all items
play: async ({ canvasElement, step }: PlaywrightProps<NavRailProps>) => { | ||
const canvas = within(canvasElement); | ||
|
||
await step("Nav rail does not load", async () => { |
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.
hides when no items
1c58609
to
6485e4e
Compare
6485e4e
to
503f6d7
Compare
OKTA-825118
Summary
feat: adds app switcher lab component
Building out the presentation layer of the "App Switcher" https://odyssey.okta.design/latest/components/app-switcher/design-mla5Wn5G (now called "Nav Rail").
Figma: https://www.figma.com/design/zh7A9gjaDlI50Hctdvd1OB/Odyssey-Components?node-id=22141-142254&node-type=frame&t=Qc7MjiWUFNtOh9Vd-0
Playground: https://6485e4e33982ca4977fff8d81ef98f680e713a9c.ods.dev/?path=/docs/labs-components-appswitcher--docs
Component checklist
Code structure
Accessibility implementation
Internationalization (i18n) implementation
Cross-browser compatibility
Chrome
Safari
Firefox
Documentation
Finalize code
QA
Testing and validation