@growth-angels/ds-core 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atoms/Button/Button.d.ts +3 -3
- package/dist/atoms/Button/Button.js +8 -8
- package/dist/layout/Container/Container.types.d.ts +1 -1
- package/package.json +1 -1
- package/src/atoms/Button/Button.scss +10 -5
- package/src/atoms/Button/Button.tsx +20 -16
- package/src/layout/Container/Container.scss +5 -2
- package/src/layout/Container/Container.types.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSX } from
|
|
2
|
-
import type { ButtonProps } from
|
|
3
|
-
import React from
|
|
1
|
+
import { JSX } from "react/jsx-runtime";
|
|
2
|
+
import type { ButtonProps } from "./Button.types";
|
|
3
|
+
import React from "react";
|
|
4
4
|
export declare const Button: <T extends React.ElementType = "button">(props: ButtonProps<T>) => JSX.Element;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from
|
|
3
|
-
import { Icon } from
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Icon } from "../Icon/Icon";
|
|
4
4
|
export const Button = (props) => {
|
|
5
5
|
const { as, children, variant, preventDefault, icon, extraClassNames, ...restProps } = props;
|
|
6
6
|
let customVariant = variant;
|
|
7
7
|
if (icon) {
|
|
8
|
-
customVariant =
|
|
8
|
+
customVariant = "icon";
|
|
9
9
|
}
|
|
10
|
-
const classNames = [
|
|
10
|
+
const classNames = ["ga-ds-button", `ga-ds-button--${customVariant}`, ...(extraClassNames || [])];
|
|
11
11
|
const handleClick = (e) => {
|
|
12
12
|
if (preventDefault)
|
|
13
13
|
e.preventDefault();
|
|
14
14
|
props?.onClick?.(e);
|
|
15
15
|
};
|
|
16
|
-
return React.createElement(as ||
|
|
16
|
+
return React.createElement(as || "button", {
|
|
17
17
|
...restProps,
|
|
18
|
-
className: classNames.join(
|
|
19
|
-
onClick: handleClick
|
|
20
|
-
}, _jsxs(_Fragment, { children: [icon && _jsx(Icon, { name: icon, size:
|
|
18
|
+
className: classNames.join(" "),
|
|
19
|
+
onClick: handleClick,
|
|
20
|
+
}, _jsxs(_Fragment, { children: [icon && _jsx(Icon, { name: icon, size: "sm" }), children && children] }));
|
|
21
21
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WordpressDefault } from "../../global.types";
|
|
2
|
-
export type ContainerSize = 'large' | 'medium' | 'small';
|
|
2
|
+
export type ContainerSize = 'large' | 'medium' | 'small' | 'full';
|
|
3
3
|
export type ContainerStretch = 'right' | 'left';
|
|
4
4
|
export interface ContainerProps extends WordpressDefault {
|
|
5
5
|
size: ContainerSize;
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
.ga-ds-button >
|
|
1
|
+
.ga-ds-button > *,
|
|
2
|
+
button.ga-ds-button {
|
|
2
3
|
padding: var(--ga-button-padding);
|
|
3
4
|
border: none;
|
|
4
5
|
font-size: var(--ga-font-sizes-base);
|
|
@@ -8,22 +9,26 @@
|
|
|
8
9
|
cursor: pointer;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
.ga-ds-button--primary >
|
|
12
|
+
.ga-ds-button--primary > *,
|
|
13
|
+
button.ga-ds-button--primary {
|
|
12
14
|
background-color: var(--ga-button-background-primary, #eee);
|
|
13
15
|
color: var(--ga-button-color-primary, #000);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
.ga-ds-button--secondary >
|
|
18
|
+
.ga-ds-button--secondary > *,
|
|
19
|
+
button.ga-ds-button--secondary {
|
|
17
20
|
background-color: var(--ga-button-background-secondary, #424242);
|
|
18
21
|
color: var(--ga-button-color-secondary, #fff);
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
.ga-ds-button--link >
|
|
24
|
+
.ga-ds-button--link > *,
|
|
25
|
+
button.ga-ds-button--link {
|
|
22
26
|
color: var(--ga-button-color-link, purple);
|
|
23
27
|
padding: 0;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
.ga-ds-button--icon >
|
|
30
|
+
.ga-ds-button--icon > *,
|
|
31
|
+
button.ga-ds-button--icon {
|
|
27
32
|
--ga-button-padding: 0.8rem 1.2rem;
|
|
28
33
|
justify-content: center;
|
|
29
34
|
align-items: center;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import { JSX } from
|
|
2
|
-
import type { ButtonProps } from
|
|
3
|
-
import React from
|
|
4
|
-
import { Icon } from
|
|
1
|
+
import { JSX } from "react/jsx-runtime"
|
|
2
|
+
import type { ButtonProps } from "./Button.types"
|
|
3
|
+
import React from "react"
|
|
4
|
+
import { Icon } from "../Icon/Icon"
|
|
5
5
|
|
|
6
6
|
export const Button = <T extends React.ElementType = "button">(props: ButtonProps<T>): JSX.Element => {
|
|
7
7
|
const { as, children, variant, preventDefault, icon, extraClassNames, ...restProps } = props
|
|
8
8
|
let customVariant = variant
|
|
9
|
-
if(icon) {
|
|
10
|
-
customVariant =
|
|
9
|
+
if (icon) {
|
|
10
|
+
customVariant = "icon"
|
|
11
11
|
}
|
|
12
|
-
const classNames = [
|
|
13
|
-
|
|
12
|
+
const classNames = ["ga-ds-button", `ga-ds-button--${customVariant}`, ...(extraClassNames || [])]
|
|
13
|
+
const handleClick: React.MouseEventHandler<React.ElementRef<T>> = (e) => {
|
|
14
14
|
if (preventDefault) e.preventDefault()
|
|
15
15
|
props?.onClick?.(e)
|
|
16
16
|
}
|
|
17
|
-
return React.createElement(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
return React.createElement(
|
|
18
|
+
as || "button",
|
|
19
|
+
{
|
|
20
|
+
...restProps,
|
|
21
|
+
className: classNames.join(" "),
|
|
22
|
+
onClick: handleClick,
|
|
23
|
+
},
|
|
24
|
+
<>
|
|
25
|
+
{icon && <Icon name={icon} size="sm" />}
|
|
26
|
+
{children && children}
|
|
27
|
+
</>
|
|
28
|
+
)
|
|
25
29
|
}
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
display: flex;
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
align-items: stretch;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
&:not(.ga-ds-container--full) {
|
|
10
|
+
padding-left: var(--ga-container-safe-zone, 2.4rem);
|
|
11
|
+
padding-right: var(--ga-container-safe-zone, 2.4rem);
|
|
12
|
+
}
|
|
10
13
|
|
|
11
14
|
&.ga-ds-container-stretch--right {
|
|
12
15
|
@include bp-up("lg") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WordpressDefault } from "../../global.types";
|
|
2
2
|
|
|
3
|
-
export type ContainerSize = 'large' | 'medium' | 'small';
|
|
3
|
+
export type ContainerSize = 'large' | 'medium' | 'small' | 'full';
|
|
4
4
|
export type ContainerStretch = 'right' | 'left'
|
|
5
5
|
|
|
6
6
|
export interface ContainerProps extends WordpressDefault {
|