-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(comments): add support for comments layout avatar config (#5944)
* chore(comments): add support for comments layout avatar config * chore(comments): remove show prop from SpacerAvatar * fix(comments): nitpicks * fix(comments): add min height to the comment list item header
- Loading branch information
1 parent
e35126e
commit dbfd001
Showing
6 changed files
with
150 additions
and
72 deletions.
There are no files selected for viewing
21 changes: 11 additions & 10 deletions
21
packages/sanity/src/structure/comments/src/components/avatars/SpacerAvatar.tsx
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,15 +1,16 @@ | ||
import type * as React from 'react' | ||
|
||
export const AVATAR_HEIGHT = 25 | ||
|
||
const INLINE_STYLE: React.CSSProperties = { | ||
minWidth: AVATAR_HEIGHT, | ||
} | ||
import {type AvatarSize} from '@sanity/ui' | ||
// eslint-disable-next-line camelcase | ||
import {getTheme_v2} from '@sanity/ui/theme' | ||
import styled, {css} from 'styled-components' | ||
|
||
/** | ||
* This component is used to as a spacer in situations where we want to align | ||
* components without avatars with components that have avatars. | ||
*/ | ||
export function SpacerAvatar() { | ||
return <div style={INLINE_STYLE} /> | ||
} | ||
export const SpacerAvatar = styled.div<{$size?: AvatarSize}>((props) => { | ||
const theme = getTheme_v2(props.theme) | ||
const {$size = 1} = props | ||
return css` | ||
min-width: ${theme.avatar.sizes[$size]?.size}px; | ||
` | ||
}) |
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
Oops, something went wrong.