Skip to content

Commit cb4242e

Browse files
authored
Feat: Style customisation in the button widget (#6052)
Added multiple style props to the button widget: - Button styles - The background colour can change with a hex code - elevation (box-shadow & colour) - There are button variant contained (solid button), outlined (only borders), text (text buttons) - Button can have an end icon or start icon
1 parent 163192d commit cb4242e

File tree

22 files changed

+726
-269
lines changed

22 files changed

+726
-269
lines changed

app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/FormWidgets/Button_spec.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,20 @@ describe("Button Widget Functionality", function() {
1919

2020
it("Button-Style Validation", function() {
2121
//Changing the style of the button from the property pane and verify it's color.
22+
// Change to Warning button sytle
23+
cy.changeButtonStyle(2, "rgb(254, 184, 17)", "rgba(0, 0, 0, 0)");
24+
cy.get(publishPage.backToEditor).click({ force: true });
25+
cy.openPropertyPane("buttonwidget");
26+
// Change to Info button sytle
27+
cy.changeButtonStyle(4, "rgb(102, 152, 255)", "rgba(0, 0, 0, 0)");
28+
cy.get(publishPage.backToEditor).click({ force: true });
29+
cy.openPropertyPane("buttonwidget");
2230
// Change to Secondary button sytle
23-
cy.changeButtonStyle(2, "rgba(0, 0, 0, 0)", "rgba(0, 0, 0, 0)");
31+
cy.changeButtonStyle(5, "rgb(133, 130, 130)", "rgba(0, 0, 0, 0)");
2432
cy.get(publishPage.backToEditor).click({ force: true });
2533
// Change to Danger button sytle
2634
cy.openPropertyPane("buttonwidget");
27-
cy.changeButtonStyle(3, "rgb(179, 3, 56)", "rgb(139, 2, 43)");
35+
cy.changeButtonStyle(3, "rgb(242, 43, 43)", "rgb(139, 2, 43)");
2836
cy.get(publishPage.backToEditor).click({ force: true });
2937
// Change to Primary button sytle
3038
cy.openPropertyPane("buttonwidget");

app/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"styled-components": "^5.2.0",
147147
"styled-system": "^5.1.5",
148148
"tern": "^0.21.0",
149-
"tinycolor2": "^1.4.1",
149+
"tinycolor2": "^1.4.2",
150150
"toposort": "^2.0.2",
151151
"ts-loader": "^6.0.4",
152152
"tslib": "^2.1.0",

app/client/src/components/designSystems/appsmith/FilePickerComponent.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ class FilePickerComponent extends React.Component<
2929
}
3030
return (
3131
<BaseButton
32-
accent="primary"
32+
buttonStyle="PRIMARY"
3333
disabled={this.props.isDisabled}
34-
filled
3534
loading={this.props.isLoading}
3635
onClick={this.openModal}
3736
text={label}

app/client/src/components/designSystems/appsmith/IconButtonComponent.tsx

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import { IconName } from "@blueprintjs/icons";
77
import { ComponentProps } from "components/designSystems/appsmith/BaseComponent";
88
import { ThemeProp } from "components/ads/common";
99
import { WIDGET_PADDING } from "constants/WidgetConstants";
10+
import {
11+
ButtonBorderRadius,
12+
ButtonBorderRadiusTypes,
13+
} from "components/propertyControls/BorderRadiusOptionsControl";
14+
import {
15+
ButtonBoxShadow,
16+
ButtonBoxShadowTypes,
17+
} from "components/propertyControls/BoxShadowOptionsControl";
1018

1119
const IconButtonContainer = styled.div`
1220
display: flex;
@@ -176,23 +184,6 @@ export enum ButtonVariantTypes {
176184
}
177185
export type ButtonVariant = keyof typeof ButtonVariantTypes;
178186

179-
export enum ButtonBorderRadiusTypes {
180-
SHARP = "SHARP",
181-
ROUNDED = "ROUNDED",
182-
CIRCLE = "CIRCLE",
183-
}
184-
export type ButtonBorderRadius = keyof typeof ButtonBorderRadiusTypes;
185-
186-
export enum ButtonBoxShadowTypes {
187-
NONE = "NONE",
188-
VARIANT1 = "VARIANT1",
189-
VARIANT2 = "VARIANT2",
190-
VARIANT3 = "VARIANT3",
191-
VARIANT4 = "VARIANT4",
192-
VARIANT5 = "VARIANT5",
193-
}
194-
export type ButtonBoxShadow = keyof typeof ButtonBoxShadowTypes;
195-
196187
export interface IconButtonComponentProps extends ComponentProps {
197188
iconName?: IconName;
198189
buttonStyle: ButtonStyle;

0 commit comments

Comments
 (0)