MCPcopy Create free account
hub / github.com/adobe/react-spectrum / AccountFooter

Function AccountFooter

packages/dev/s2-docs/pages/s2/SideNavPanelApp.tsx:47–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 * never in the layout while the panel is changing size and can't reflow as it narrows.
46 */
47export function AccountFooter(): ReactNode {
48 let {isCollapsed = false} = useContext(SideNavPanelContext);
49
50 return (
51 <div
52 className={style({
53 display: 'flex',
54 flexDirection: {default: 'row', isCollapsed: 'column-reverse'},
55 // Left aligned in both states, and with the same padding either way, so that the contents
56 // sit at the same offset whatever the panel's width is. Centering them in the collapsed
57 // rail would drag them across the panel as it widens, since the centre moves but the rows
58 // on either side of it don't.
59 alignItems: {default: 'center', isCollapsed: 'start'},
60 justifyContent: 'start',
61 gap: 8,
62 padding: 4,
63 flexShrink: 0
64 })({isCollapsed})}>
65 <ActionButton isQuiet>
66 <Avatar alt="Jordan Rivera" src="https://i.imgur.com/xIe7Wlb.png" size={24} />
67 </ActionButton>
68 <div
69 className={style({
70 display: {default: 'block', isCollapsed: 'none'},
71 minWidth: 0,
72 flexGrow: 1
73 })({isCollapsed})}>
74 <Text styles={style({font: 'ui'})}>Jordan Rivera</Text>
75 </div>
76 <ActionMenu aria-label="Account" isQuiet direction={isCollapsed ? 'right' : 'top'}>
77 <ActionMenuItem>Profile</ActionMenuItem>
78 <ActionMenuItem>Settings</ActionMenuItem>
79 <ActionMenuItem>Sign out</ActionMenuItem>
80 </ActionMenu>
81 </div>
82 );
83}
84
85interface ProfileMenuProps {
86 isCollapsed: boolean;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected