Skip to content

Commit

Permalink
feat(core): make workspace subtitle configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanwikner committed Nov 7, 2022
1 parent 0f36a5c commit 2c60fe9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function WorkspaceAuth() {
<WorkspacePreview
icon={selectedWorkspace.icon}
title={selectedWorkspace.title}
subtitle={selectedWorkspace.dataset}
subtitle={selectedWorkspace?.subtitle}
/>
</Box>
}
Expand Down Expand Up @@ -116,7 +116,7 @@ export function WorkspaceAuth() {
icon={workspace?.icon}
iconRight={ChevronRightIcon}
state={state}
subtitle={workspace.dataset}
subtitle={workspace?.subtitle}
title={workspace?.title || workspace.name}
/>
</Card>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AddIcon, SelectIcon} from '@sanity/icons'
import {SelectIcon} from '@sanity/icons'
import {
Button,
MenuButton,
Expand All @@ -7,15 +7,13 @@ import {
MenuButtonProps,
ButtonProps,
Box,
Card,
Label,
} from '@sanity/ui'
import React, {useMemo} from 'react'
import styled from 'styled-components'
import {useActiveWorkspace} from '../../../activeWorkspaceMatcher'
import {useColorScheme} from '../../../colorScheme'
import {useWorkspaces} from '../../../workspaces'
import {WORKSPACES_DOCS_URL} from './constants'
import {useWorkspaceAuthStates} from './hooks'
import {WorkspacePreview} from './WorkspacePreview'
import {useRouter} from 'sanity/router'
Expand All @@ -25,11 +23,6 @@ const StyledMenu = styled(Menu)`
min-width: 250px;
`

const FooterCard = styled(Card)`
position: sticky;
bottom: 0;
`

export function WorkspaceMenuButton(props: ButtonProps) {
const {scheme} = useColorScheme()
const workspaces = useWorkspaces()
Expand All @@ -47,7 +40,7 @@ export function WorkspaceMenuButton(props: ButtonProps) {
button={<Button icon={SelectIcon} mode="bleed" {...props} disabled={!authStates} />}
id="workspace-menu"
menu={
<StyledMenu paddingBottom={0}>
<StyledMenu>
<Box paddingX={3} paddingY={3}>
<Label size={1} muted>
Workspaces
Expand Down Expand Up @@ -88,23 +81,12 @@ export function WorkspaceMenuButton(props: ButtonProps) {
icon={workspace?.icon}
selected={workspace.name === activeWorkspace.name}
state={state}
subtitle={workspace.dataset}
subtitle={workspace?.subtitle}
title={workspace?.title || workspace.name}
/>
</MenuItem>
)
})}

<FooterCard borderTop paddingY={1}>
<MenuItem
as="a"
href={WORKSPACES_DOCS_URL}
icon={AddIcon}
rel="noopener noreferrer"
target="__blank"
text="Add workspace"
/>
</FooterCard>
</StyledMenu>
}
popover={popoverProps}
Expand Down

0 comments on commit 2c60fe9

Please sign in to comment.