fix: make edit and delete comment button subtle (#3835)

This commit is contained in:
Cosimo Chetta
2024-09-03 14:23:11 +02:00
committed by GitHub
parent 63b55300f2
commit ea012d90bf
4 changed files with 19 additions and 22 deletions

View File

@@ -24,8 +24,8 @@ export const ButtonShowReplies = (props: Props) => {
data-cy="show-replies" data-cy="show-replies"
icon={icon} icon={icon}
onClick={setIsShowReplies} onClick={setIsShowReplies}
sx={{ alignSelf: 'flex-start', border: 'none' }} sx={{ alignSelf: 'flex-start' }}
variant="outline" variant="subtle"
small small
> >
{text} {creatorName && ` to ${creatorName}`} {text} {creatorName && ` to ${creatorName}`}

View File

@@ -98,7 +98,7 @@ export const CommentItem = (props: IProps) => {
)} )}
{!_deleted && ( {!_deleted && (
<Flex sx={{ gap: 2 }}> <Flex sx={{ gap: 2, flexGrow: 1 }}>
<Box data-cy="commentAvatar" data-testid="commentAvatar"> <Box data-cy="commentAvatar" data-testid="commentAvatar">
<Avatar <Avatar
src={creatorImage ?? defaultProfileImage} src={creatorImage ?? defaultProfileImage}
@@ -118,9 +118,8 @@ export const CommentItem = (props: IProps) => {
> >
<Flex <Flex
sx={{ sx={{
alignItems: 'stretch',
flexWrap: 'wrap', flexWrap: 'wrap',
justifyContent: 'flex-start', justifyContent: 'space-between',
flexDirection: ['column', 'row'], flexDirection: ['column', 'row'],
gap: 2, gap: 2,
}} }}
@@ -144,17 +143,15 @@ export const CommentItem = (props: IProps) => {
{isEditable && ( {isEditable && (
<Flex <Flex
sx={{ sx={{
flexGrow: 1, alignItems: 'flex-end',
gap: 2, gap: 2,
justifyContent: ['flex-start', 'flex-end'], paddingBottom: 2,
opacity: 0.5,
':hover': { opacity: 1 },
}} }}
> >
<Button <Button
type="button" type="button"
data-cy={`${item}: edit button`} data-cy={`${item}: edit button`}
variant="outline" variant="subtle"
small={true} small={true}
icon="edit" icon="edit"
onClick={() => onEditRequest(_id)} onClick={() => onEditRequest(_id)}
@@ -164,7 +161,7 @@ export const CommentItem = (props: IProps) => {
<Button <Button
type="button" type="button"
data-cy={`${item}: delete button`} data-cy={`${item}: delete button`}
variant={'outline'} variant="subtle"
small={true} small={true}
icon="delete" icon="delete"
onClick={() => setShowDeleteModal(true)} onClick={() => setShowDeleteModal(true)}

View File

@@ -18,32 +18,32 @@ export const getButtons = (colors: ThemeWithName['colors']) => ({
primary: { primary: {
...BASE_BUTTON, ...BASE_BUTTON,
color: colors.black, color: colors.black,
bg: colors.accent.base, backgroundColor: colors.accent.base,
'&:hover': { '&:hover': {
bg: colors.accent.hover, backgroundColor: colors.accent.hover,
}, },
'&[disabled]': { '&[disabled]': {
opacity: 0.5, opacity: 0.5,
cursor: 'not-allowed', cursor: 'not-allowed',
}, },
'&[disabled]:hover': { '&[disabled]:hover': {
bg: colors.accent.base, backgroundColor: colors.accent.base,
}, },
}, },
secondary: { secondary: {
...BASE_BUTTON, ...BASE_BUTTON,
border: '2px solid ' + colors.black, border: '2px solid ' + colors.black,
color: colors.black, color: colors.black,
bg: colors.softblue, backgroundColor: colors.softblue,
'&:hover': { '&:hover': {
bg: colors.white, backgroundColor: colors.white,
cursor: 'pointer', cursor: 'pointer',
}, },
'&[disabled]': { '&[disabled]': {
opacity: 0.5, opacity: 0.5,
}, },
'&[disabled]:hover': { '&[disabled]:hover': {
bg: colors.softblue, backgroundColor: colors.softblue,
}, },
}, },
destructive: { destructive: {
@@ -81,18 +81,17 @@ export const getButtons = (colors: ThemeWithName['colors']) => ({
}, },
subtle: { subtle: {
...BASE_BUTTON, ...BASE_BUTTON,
borderColor: colors.softblue, borderWidth: 0,
color: colors.black, color: colors.black,
bg: colors.softblue, backgroundColor: 'transparent',
'&:hover': { '&:hover': {
bg: colors.offwhite, backgroundColor: colors.softblue,
borderColor: colors.offwhite,
}, },
'&[disabled]': { '&[disabled]': {
opacity: 0.5, opacity: 0.5,
}, },
'&[disabled]:hover': { '&[disabled]:hover': {
bg: colors.softblue, backgroundColor: colors.softblue,
}, },
}, },
breadcrumb: { breadcrumb: {

View File

@@ -48,6 +48,7 @@ export const HideDiscussionContainer = ({
textAlign: 'center', textAlign: 'center',
display: 'block', display: 'block',
marginBottom: viewComments ? 2 : 0, marginBottom: viewComments ? 2 : 0,
'&:hover': { bg: '#ececec' },
}} }}
onClick={() => setViewComments((prev) => !prev)} onClick={() => setViewComments((prev) => !prev)}
backgroundColor={viewComments ? '#c2daf0' : '#e2edf7'} backgroundColor={viewComments ? '#c2daf0' : '#e2edf7'}