Skip to content

Commit 30697ae

Browse files
haojin111sumitsumakash-codemonktechbhavinpranavkanade
authored
feat: task 7139 - button link v2 (#7227)
* remove outermost quotes (#6938) * This method removes the outermost quotes - single or double quotes - so that end users don't have to do it via javascript inside widget fields where they are meant to be bound. * fix: Wrap JSON.stringify for text widget binding(suggested widgets) (#6651) * Table widget: default selected row, 0th (#5930) * added cell background of empty rows (#6353) * added cell background of empty rows * added tooltips for all the btns in comment card (#6952) * updated button and link button as v2 design Co-authored-by: Sumit Kumar <sumit@appsmith.com> Co-authored-by: akash-codemonk <67054171+akash-codemonk@users.noreply.github.com> Co-authored-by: Bhavin K <58818598+techbhavin@users.noreply.github.com> Co-authored-by: Pranav Kanade <pranav@appsmith.com>
1 parent 8e62168 commit 30697ae

File tree

7 files changed

+190
-41
lines changed

7 files changed

+190
-41
lines changed

app/client/src/comments/CommentCard/CommentContextMenu.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ import {
99
UNPIN_COMMENT,
1010
createMessage,
1111
EDIT_COMMENT,
12+
MORE_OPTIONS,
1213
} from "constants/messages";
1314
import { noop } from "lodash";
1415

1516
import "@blueprintjs/popover2/lib/css/blueprint-popover2.css";
1617

1718
import { Popover2 } from "@blueprintjs/popover2";
19+
import Tooltip from "components/ads/Tooltip";
1820

1921
// render over popover portals
2022
const Container = styled.div``;
@@ -149,7 +151,9 @@ function CommentContextMenu({
149151
placement={"bottom-end"}
150152
portalClassName="comment-context-menu"
151153
>
152-
<StyledIcon name="comment-context-menu" size={IconSize.LARGE} />
154+
<Tooltip content={createMessage(MORE_OPTIONS)}>
155+
<StyledIcon name="comment-context-menu" size={IconSize.LARGE} />
156+
</Tooltip>
153157
</Popover2>
154158
);
155159
}

app/client/src/comments/CommentCard/ResolveCommentButton.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React from "react";
22
import styled, { withTheme } from "styled-components";
33
import Icon, { IconSize } from "components/ads/Icon";
44
import { Theme } from "constants/DefaultTheme";
5+
import Tooltip from "components/ads/Tooltip";
6+
import { createMessage, RESOLVE_THREAD } from "constants/messages";
57

68
const Container = styled.div`
79
display: flex;
@@ -52,14 +54,16 @@ const ResolveCommentButton = withTheme(
5254

5355
return (
5456
<Container onClick={_handleClick}>
55-
<StyledResolveIcon
56-
fillColor={fillColor}
57-
keepColors
58-
name="oval-check"
59-
size={IconSize.XXL}
60-
strokeColorCircle={strokeColorCircle}
61-
strokeColorPath={strokeColorPath}
62-
/>
57+
<Tooltip content={createMessage(RESOLVE_THREAD)}>
58+
<StyledResolveIcon
59+
fillColor={fillColor}
60+
keepColors
61+
name="oval-check"
62+
size={IconSize.XXL}
63+
strokeColorCircle={strokeColorCircle}
64+
strokeColorPath={strokeColorPath}
65+
/>
66+
</Tooltip>
6367
</Container>
6468
);
6569
},

app/client/src/components/ads/Button.tsx

Lines changed: 116 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,38 @@ const getDisabledStyles = (props: ThemeProp & ButtonProps) => {
7979
const variant = props.variant || defaultProps.variant;
8080
const category = props.category || defaultProps.category;
8181

82+
if (props.tag === "a") {
83+
return {
84+
bgColorPrimary: "transparent",
85+
borderColorPrimary: "transparent",
86+
txtColorPrimary: props.theme.colors.button.link.disabled,
87+
bgColorSecondary: "transparent",
88+
borderColorSecondary: "transparent",
89+
txtColorSecondary: props.theme.colors.button.link.disabled,
90+
bgColorTertiary: "transparent",
91+
borderColorTertiary: "transparent",
92+
txtColorTertiary: props.theme.colors.button.link.disabled,
93+
};
94+
}
8295
const stylesByCategory = {
8396
[Category.primary]: {
8497
txtColorPrimary: props.theme.colors.button.disabledText,
85-
bgColorPrimary: props.theme.colors[variant].darkest,
86-
borderColorPrimary: props.theme.colors[variant].darkest,
98+
bgColorPrimary: props.theme.colors[variant].darker,
99+
borderColorPrimary: props.theme.colors[variant].darker,
87100
},
88101
[Category.secondary]: {
89102
txtColorSecondary: props.theme.colors.button.disabledText,
90-
bgColorSecondary: props.theme.colors[variant].darkest,
91-
borderColorSecondary: props.theme.colors[variant].darker,
103+
bgColorSecondary: props.theme.colors[variant].darker,
104+
borderColorSecondary: props.isLoading
105+
? props.theme.colors[variant].darkest
106+
: props.theme.colors.tertiary.darker,
92107
},
93108
[Category.tertiary]: {
94109
txtColorTertiary: props.theme.colors.button.disabledText,
95-
bgColorTertiary: props.theme.colors.tertiary.darker,
96-
borderColorTertiary: props.theme.colors.tertiary.dark,
110+
bgColorTertiary: props.theme.colors.tertiary.dark,
111+
borderColorTertiary: props.isLoading
112+
? props.theme.colors.tertiary.darkest
113+
: props.theme.colors.tertiary.darker,
97114
},
98115
};
99116

@@ -104,6 +121,19 @@ const getMainStateStyles = (props: ThemeProp & ButtonProps) => {
104121
const variant = props.variant || defaultProps.variant;
105122
const category = props.category || defaultProps.category;
106123

124+
if (props.tag === "a") {
125+
return {
126+
bgColorPrimary: "transparent",
127+
borderColorPrimary: "transparent",
128+
txtColorPrimary: props.theme.colors.button.link.main,
129+
bgColorSecondary: "transparent",
130+
borderColorSecondary: "transparent",
131+
txtColorSecondary: props.theme.colors.button.link.main,
132+
bgColorTertiary: "transparent",
133+
borderColorTertiary: "transparent",
134+
txtColorTertiary: props.theme.colors.button.link.main,
135+
};
136+
}
107137
const stylesByCategory = {
108138
[Category.primary]: {
109139
bgColorPrimary: props.theme.colors[variant].main,
@@ -129,6 +159,20 @@ const getHoverStateStyles = (props: ThemeProp & ButtonProps) => {
129159
const variant = props.variant || defaultProps.variant;
130160
const category = props.category || defaultProps.category;
131161

162+
if (props.tag === "a") {
163+
return {
164+
bgColorPrimary: "transparent",
165+
borderColorPrimary: "transparent",
166+
txtColorPrimary: props.theme.colors.button.link.hover,
167+
bgColorSecondary: "transparent",
168+
borderColorSecondary: "transparent",
169+
txtColorSecondary: props.theme.colors.button.link.hover,
170+
bgColorTertiary: "transparent",
171+
borderColorTertiary: "transparent",
172+
txtColorTertiary: props.theme.colors.button.link.hover,
173+
};
174+
}
175+
132176
const stylesByCategory = {
133177
[Category.primary]: {
134178
bgColorPrimary: props.theme.colors[variant].dark,
@@ -154,6 +198,19 @@ const getActiveStateStyles = (props: ThemeProp & ButtonProps) => {
154198
const variant = props.variant || defaultProps.variant;
155199
const category = props.category || defaultProps.category;
156200

201+
if (props.tag === "a") {
202+
return {
203+
bgColorPrimary: "transparent",
204+
borderColorPrimary: "transparent",
205+
txtColorPrimary: props.theme.colors.button.link.active,
206+
bgColorSecondary: "transparent",
207+
borderColorSecondary: "transparent",
208+
txtColorSecondary: props.theme.colors.button.link.active,
209+
bgColorTertiary: "transparent",
210+
borderColorTertiary: "transparent",
211+
txtColorTertiary: props.theme.colors.button.link.active,
212+
};
213+
}
157214
const stylesByCategory = {
158215
[Category.primary]: {
159216
bgColorPrimary: props.theme.colors[variant].dark,
@@ -307,11 +364,25 @@ const ButtonStyles = css<ThemeProp & ButtonProps>`
307364
border-radius: 0;
308365
${(props) => btnFontStyles(props).buttonFont};
309366
padding: ${(props) => btnFontStyles(props).padding};
310-
.${Classes.ICON} {
367+
.${Classes.ICON}:not([name="no-response"]) {
311368
margin-right: ${(props) =>
312369
props.text && props.icon ? `${props.theme.spaces[2] - 1}px` : `0`};
313370
path {
314371
fill: ${(props) => btnColorStyles(props, "main").txtColor};
372+
&[stroke-width],
373+
&[stroke] {
374+
stroke: ${(props) => btnColorStyles(props, "main").txtColor};
375+
fill: transparent;
376+
}
377+
}
378+
rect[stroke] {
379+
stroke: ${(props) => btnColorStyles(props, "main").txtColor};
380+
}
381+
&[name="search"] {
382+
circle {
383+
fill: transparent;
384+
stroke: ${(props) => btnColorStyles(props, "main").txtColor};
385+
}
315386
}
316387
}
317388
&:hover {
@@ -326,6 +397,20 @@ const ButtonStyles = css<ThemeProp & ButtonProps>`
326397
props.text && props.icon ? `${props.theme.spaces[2] - 1}px` : `0`};
327398
path {
328399
fill: ${(props) => btnColorStyles(props, "hover").txtColor};
400+
&[stroke-width],
401+
&[stroke] {
402+
fill: transparent;
403+
stroke: ${(props) => btnColorStyles(props, "hover").txtColor};
404+
}
405+
}
406+
rect[stroke] {
407+
stroke: ${(props) => btnColorStyles(props, "hover").txtColor};
408+
}
409+
&[name="search"] {
410+
circle {
411+
fill: transparent;
412+
stroke: ${(props) => btnColorStyles(props, "hover").txtColor};
413+
}
329414
}
330415
}
331416
}
@@ -339,6 +424,20 @@ const ButtonStyles = css<ThemeProp & ButtonProps>`
339424
.${Classes.ICON} {
340425
path {
341426
fill: ${(props) => btnColorStyles(props, "active").txtColor};
427+
&[stroke-width],
428+
&[stroke] {
429+
fill: transparent;
430+
stroke: ${(props) => btnColorStyles(props, "active").txtColor};
431+
}
432+
}
433+
rect[stroke] {
434+
stroke: ${(props) => btnColorStyles(props, "active").txtColor};
435+
}
436+
&[name="search"] {
437+
circle {
438+
fill: transparent;
439+
stroke: ${(props) => btnColorStyles(props, "active").txtColor};
440+
}
342441
}
343442
}
344443
}
@@ -352,6 +451,9 @@ const ButtonStyles = css<ThemeProp & ButtonProps>`
352451
right: 0;
353452
margin-left: auto;
354453
margin-right: auto;
454+
circle {
455+
stroke: ${(props) => props.theme.colors.button.disabledText};
456+
}
355457
}
356458
`;
357459

@@ -361,6 +463,8 @@ const StyledButton = styled("button")`
361463

362464
const StyledLinkButton = styled("a")`
363465
${ButtonStyles}
466+
background: transparent;
467+
border-color: transparent;
364468
`;
365469

366470
export const VisibilityWrapper = styled.div`
@@ -407,8 +511,11 @@ const getTextContent = (props: ButtonProps) =>
407511

408512
const getButtonContent = (props: ButtonProps) => (
409513
<>
410-
{getIconContent(props)}
411-
<span>{getTextContent(props)}</span>
514+
{props.tag === "button" && getIconContent(props)}
515+
<span style={{ marginRight: props.tag === "a" ? 7.67 : 0 }}>
516+
{getTextContent(props)}
517+
</span>
518+
{props.tag === "a" && getIconContent(props)}
412519
{props.isLoading ? <Spinner size={IconSizeProp(props.size)} /> : null}
413520
</>
414521
);

app/client/src/components/ads/EmojiPicker.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { withTheme } from "styled-components";
77
import { Theme } from "constants/DefaultTheme";
88
import "@blueprintjs/popover2/lib/css/blueprint-popover2.css";
99
import "emoji-mart/css/emoji-mart.css";
10+
import Tooltip from "components/ads/Tooltip";
11+
import { ADD_REACTION, createMessage, EMOJI } from "constants/messages";
1012

1113
const EmojiPicker = withTheme(
1214
({
@@ -50,12 +52,14 @@ const EmojiPicker = withTheme(
5052
}}
5153
portalClassName="emoji-picker-portal"
5254
>
53-
<Icon
54-
fillColor={theme.colors.comments.emojiPicker}
55-
keepColors
56-
name={iconName || "emoji"}
57-
size={iconSize || IconSize.XXXL}
58-
/>
55+
<Tooltip content={createMessage(iconName ? ADD_REACTION : EMOJI)}>
56+
<Icon
57+
fillColor={theme.colors.comments.emojiPicker}
58+
keepColors
59+
name={iconName || "emoji"}
60+
size={iconSize || IconSize.XXXL}
61+
/>
62+
</Tooltip>
5963
</Popover2>
6064
);
6165
},

app/client/src/components/designSystems/appsmith/TableComponent/TableUtilities.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,12 @@ export const renderEmptyRows = (
329329
<div {...rowProps} className="tr" key={index}>
330330
{multiRowSelection && renderCheckBoxCell(false)}
331331
{row.cells.map((cell: any, cellIndex: number) => {
332-
return (
333-
<div {...cell.getCellProps()} className="td" key={cellIndex} />
334-
);
332+
const cellProps = cell.getCellProps();
333+
if (columns[0]?.columnProperties?.cellBackground) {
334+
cellProps.style.background =
335+
columns[0].columnProperties.cellBackground;
336+
}
337+
return <div {...cellProps} className="td" key={cellIndex} />;
335338
})}
336339
</div>
337340
);

0 commit comments

Comments
 (0)