@servicetitan/mpa-components 2.0.0 → 2.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/CHANGELOG.md +8 -0
- package/lib/components/brands/brand-card/actions-button-section.d.ts +1 -1
- package/lib/components/brands/brand-card/actions-button-section.d.ts.map +1 -1
- package/lib/components/brands/brand-card/actions-button-section.js +4 -8
- package/lib/components/brands/brand-card/actions-button-section.js.map +1 -1
- package/lib/components/brands/brand-card/brand-card.d.ts.map +1 -1
- package/lib/components/brands/brand-card/brand-card.js +3 -5
- package/lib/components/brands/brand-card/brand-card.js.map +1 -1
- package/lib/components/brands/brand-card/info-section.d.ts +11 -0
- package/lib/components/brands/brand-card/info-section.d.ts.map +1 -0
- package/lib/components/brands/brand-card/info-section.js +4 -0
- package/lib/components/brands/brand-card/info-section.js.map +1 -0
- package/lib/components/brands/styles.module.less +0 -23
- package/package.json +2 -2
- package/src/components/brands/brand-card/actions-button-section.tsx +7 -27
- package/src/components/brands/brand-card/brand-card.tsx +16 -10
- package/src/components/brands/brand-card/info-section.tsx +32 -0
- package/src/components/brands/styles.module.less +0 -23
- package/src/components/brands/styles.module.less.d.ts +0 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/components/brands/brand-card/brand-logo.d.ts +0 -6
- package/lib/components/brands/brand-card/brand-logo.d.ts.map +0 -1
- package/lib/components/brands/brand-card/brand-logo.js +0 -8
- package/lib/components/brands/brand-card/brand-logo.js.map +0 -1
- package/lib/components/brands/brand-card/cart-tags.d.ts +0 -6
- package/lib/components/brands/brand-card/cart-tags.d.ts.map +0 -1
- package/lib/components/brands/brand-card/cart-tags.js +0 -10
- package/lib/components/brands/brand-card/cart-tags.js.map +0 -1
- package/lib/components/brands/brand-card/name-and-mail-section.d.ts +0 -7
- package/lib/components/brands/brand-card/name-and-mail-section.d.ts.map +0 -1
- package/lib/components/brands/brand-card/name-and-mail-section.js +0 -7
- package/lib/components/brands/brand-card/name-and-mail-section.js.map +0 -1
- package/src/components/brands/brand-card/brand-logo.tsx +0 -21
- package/src/components/brands/brand-card/cart-tags.tsx +0 -20
- package/src/components/brands/brand-card/name-and-mail-section.tsx +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.1.0](https://github.com/servicetitan/marketing/compare/@servicetitan/mpa-components@2.0.0...@servicetitan/mpa-components@2.1.0) (2025-04-17)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @servicetitan/mpa-components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [2.0.0](https://github.com/servicetitan/marketing/compare/@servicetitan/mpa-components@1.11.0...@servicetitan/mpa-components@2.0.0) (2025-04-10)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @servicetitan/mpa-components
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions-button-section.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"actions-button-section.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAMhC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC;IAClC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;CACxC,CA+BA,CAAC"}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { useState } from 'react';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import { useHistory } from 'react-router-dom';
|
|
4
|
-
import {
|
|
3
|
+
import { Menu } from '@servicetitan/anvil2';
|
|
5
4
|
import { SingleActionButtonSection } from './single-action-button';
|
|
6
5
|
export const ActionsButtonSection = ({ actions }) => {
|
|
7
|
-
const [isOpen, setOpen] = useState(false);
|
|
8
6
|
const history = useHistory();
|
|
9
7
|
if (!Array.isArray(actions)) {
|
|
10
8
|
return _jsx(SingleActionButtonSection, { action: actions });
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
return (_jsx(ActionMenu, { trigger: trigger, open: isOpen, onClickOutside: () => setOpen(false), direction: "bl", className: "qa-brand-card-action-menu", children: actions.map(action => {
|
|
10
|
+
return (_jsx(Menu, { label: "Actions", className: "qa-brand-card-action-menu", size: "small", children: actions.map(action => {
|
|
14
11
|
const actionClick = () => {
|
|
15
|
-
setOpen(false);
|
|
16
12
|
if (action.action) {
|
|
17
13
|
action.action();
|
|
18
14
|
}
|
|
@@ -20,7 +16,7 @@ export const ActionsButtonSection = ({ actions }) => {
|
|
|
20
16
|
history.push(action.href);
|
|
21
17
|
}
|
|
22
18
|
};
|
|
23
|
-
return (_jsx(
|
|
19
|
+
return (_jsx(Menu.Item, { disabled: action.disabled, onClick: actionClick, className: "qa-brand-card-action-menu-item", label: action.name }, action.name));
|
|
24
20
|
}) }));
|
|
25
21
|
};
|
|
26
22
|
//# sourceMappingURL=actions-button-section.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions-button-section.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"actions-button-section.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,MAAM,CAAC,MAAM,oBAAoB,GAE5B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACjB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAC,yBAAyB,IAAC,MAAM,EAAE,OAAO,GAAI,CAAC;IAC1D,CAAC;IAED,OAAO,CACH,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,EAAC,SAAS,EAAC,2BAA2B,EAAC,IAAI,EAAC,OAAO,YACnE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAClB,MAAM,WAAW,GAAG,GAAG,EAAE;gBACrB,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;oBAChB,MAAM,CAAC,MAAM,EAAE,CAAC;gBACpB,CAAC;gBACD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;oBACd,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC;YAEF,OAAO,CACH,KAAC,IAAI,CAAC,IAAI,IACN,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAEzB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAC,gCAAgC,EAC1C,KAAK,EAAE,MAAM,CAAC,IAAI,IAHb,MAAM,CAAC,IAAI,CAIlB,CACL,CAAC;QACN,CAAC,CAAC,GACC,CACV,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand-card.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"brand-card.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ3D,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA+CxC,CAAC"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { Flex, Card } from '@servicetitan/anvil2';
|
|
4
|
-
import { NameAndMailSection } from './name-and-mail-section';
|
|
3
|
+
import { Flex, Card, Avatar } from '@servicetitan/anvil2';
|
|
5
4
|
import { ActionsButtonSection } from './actions-button-section';
|
|
6
|
-
import {
|
|
7
|
-
import { BrandLogo } from './brand-logo';
|
|
5
|
+
import { InfoSection } from './info-section';
|
|
8
6
|
import * as Styles from '../styles.module.less';
|
|
9
7
|
const BRAND_NAME_PLACEHOLDER = 'Assign Brand Name';
|
|
10
8
|
export const BrandCard = ({ actions, email, isDefault, isShared, logo, name, hasError, }) => {
|
|
11
9
|
const nameToShow = name || BRAND_NAME_PLACEHOLDER;
|
|
12
10
|
return (_jsx(Card, { className: classNames({
|
|
13
11
|
[Styles.cardWithError]: hasError,
|
|
14
|
-
}, Styles.brandCard, 'qa-brand-card'), padding: "large", children: _jsxs(Flex, { className: Styles.cardContent, justifyContent: "space-between", direction: "column", children: [_jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", className: "qa-brand-card-left-section", children: [_jsx(
|
|
12
|
+
}, Styles.brandCard, 'qa-brand-card'), padding: "large", children: _jsxs(Flex, { className: Styles.cardContent, justifyContent: "space-between", direction: "column", gap: "6", children: [_jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", className: "qa-brand-card-left-section", children: [_jsx(Avatar, { image: logo, name: nameToShow, size: "large" }), _jsx(ActionsButtonSection, { actions: actions })] }), _jsx(InfoSection, { name: name, nameToShow: nameToShow, email: email, isDefault: isDefault, isShared: isShared })] }) }));
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=brand-card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand-card.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"brand-card.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAEnD,MAAM,CAAC,MAAM,SAAS,GAAuB,CAAC,EAC1C,OAAO,EACP,KAAK,EACL,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,QAAQ,GACX,EAAE,EAAE;IACD,MAAM,UAAU,GAAG,IAAI,IAAI,sBAAsB,CAAC;IAElD,OAAO,CACH,KAAC,IAAI,IACD,SAAS,EAAE,UAAU,CACjB;YACI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ;SACnC,EACD,MAAM,CAAC,SAAS,EAChB,eAAe,CAClB,EACD,OAAO,EAAC,OAAO,YAEf,MAAC,IAAI,IACD,SAAS,EAAE,MAAM,CAAC,WAAW,EAC7B,cAAc,EAAC,eAAe,EAC9B,SAAS,EAAC,QAAQ,EAClB,GAAG,EAAC,GAAG,aAEP,MAAC,IAAI,IACD,cAAc,EAAC,eAAe,EAC9B,UAAU,EAAC,YAAY,EACvB,SAAS,EAAC,4BAA4B,aAEtC,KAAC,MAAM,IAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAC,OAAO,GAAG,EACtD,KAAC,oBAAoB,IAAC,OAAO,EAAE,OAAO,GAAI,IACvC,EAEP,KAAC,WAAW,IACR,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GACpB,IACC,GACJ,CACV,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
interface InfoSectionProps {
|
|
3
|
+
nameToShow: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
isDefault?: boolean;
|
|
7
|
+
isShared?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const InfoSection: FC<InfoSectionProps>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=info-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-section.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/info-section.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,UAAU,gBAAgB;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAmB5C,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Chip, Flex, Text } from '@servicetitan/anvil2';
|
|
3
|
+
export const InfoSection = ({ nameToShow, email, isDefault, isShared }) => (_jsx(Flex, { direction: "column", gap: "4", children: _jsxs(Flex, { direction: "column", gap: "1", children: [_jsxs(Flex, { gap: "2", alignItems: "center", children: [_jsx(Text, { className: "t-truncate-i m-0", title: nameToShow, variant: "headline", el: "h3", children: nameToShow }), _jsxs(Flex, { gap: "1", children: [isDefault && _jsx(Chip, { label: "Default" }), isShared && _jsx(Chip, { color: "#b5deff", label: "Corporate HQ" })] })] }), email && (_jsx(Text, { subdued: true, title: email, className: "t-truncate-i", children: email }))] }) }));
|
|
4
|
+
//# sourceMappingURL=info-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info-section.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/info-section.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAUxD,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAC7F,KAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,YAC5B,MAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,aAC5B,MAAC,IAAI,IAAC,GAAG,EAAC,GAAG,EAAC,UAAU,EAAC,QAAQ,aAC7B,KAAC,IAAI,IAAC,SAAS,EAAC,kBAAkB,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAC,UAAU,EAAC,EAAE,EAAC,IAAI,YAC3E,UAAU,GACR,EACP,MAAC,IAAI,IAAC,GAAG,EAAC,GAAG,aACR,SAAS,IAAI,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,GAAG,EACrC,QAAQ,IAAI,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAC,cAAc,GAAG,IACvD,IACJ,EACN,KAAK,IAAI,CACN,KAAC,IAAI,IAAC,OAAO,QAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,cAAc,YAC/C,KAAK,GACH,CACV,IACE,GACJ,CACV,CAAC"}
|
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
@card-max-width: 700px;
|
|
6
6
|
@max-number-of-cards: 3;
|
|
7
7
|
|
|
8
|
-
.delete-tooltip {
|
|
9
|
-
min-width: 327px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
8
|
.grid {
|
|
13
9
|
grid-template-columns: repeat(auto-fill, minmax(@card-min-width, 1fr));
|
|
14
10
|
max-width: calc(@card-max-width * @max-number-of-cards + @spacing-3 * 2);
|
|
@@ -27,7 +23,6 @@
|
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
.brand-card {
|
|
30
|
-
height: 200px;
|
|
31
26
|
min-width: @card-min-width;
|
|
32
27
|
max-width: @card-max-width;
|
|
33
28
|
}
|
|
@@ -36,24 +31,6 @@
|
|
|
36
31
|
width: 100%;
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
.card-left-section-texts {
|
|
40
|
-
min-width: 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.brand-img {
|
|
44
|
-
width: @spacing-6;
|
|
45
|
-
height: @spacing-6;
|
|
46
|
-
min-width: @spacing-6;
|
|
47
|
-
min-height: @spacing-6;
|
|
48
|
-
border-radius: @border-radius-circular;
|
|
49
|
-
border: solid 1px @color-neutral-60;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.brand-img-placeholder {
|
|
53
|
-
.brand-img();
|
|
54
|
-
background-color: @color-neutral-60;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
34
|
.card-with-error {
|
|
58
35
|
border-color: @color-red-500;
|
|
59
36
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"repository": {
|
|
4
4
|
"url": "https://github.com/servicetitan/marketing"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.1.0",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"cli": {
|
|
35
35
|
"webpack": false
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "fc10244696665b2bc7e58fc2404e314da0013ad2"
|
|
38
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FC
|
|
1
|
+
import type { FC } from 'react';
|
|
2
2
|
import { useHistory } from 'react-router-dom';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Menu } from '@servicetitan/anvil2';
|
|
5
5
|
|
|
6
6
|
import { SingleActionButtonSection } from './single-action-button';
|
|
7
7
|
import { BrandAction } from '../../../utils/interfaces';
|
|
@@ -9,35 +9,16 @@ import { BrandAction } from '../../../utils/interfaces';
|
|
|
9
9
|
export const ActionsButtonSection: FC<{
|
|
10
10
|
actions: BrandAction | BrandAction[];
|
|
11
11
|
}> = ({ actions }) => {
|
|
12
|
-
const [isOpen, setOpen] = useState(false);
|
|
13
12
|
const history = useHistory();
|
|
14
13
|
|
|
15
14
|
if (!Array.isArray(actions)) {
|
|
16
15
|
return <SingleActionButtonSection action={actions} />;
|
|
17
16
|
}
|
|
18
17
|
|
|
19
|
-
const trigger = (
|
|
20
|
-
<Button
|
|
21
|
-
outline
|
|
22
|
-
size="small"
|
|
23
|
-
onClick={() => setOpen(true)}
|
|
24
|
-
className="qa-brand-card-actions-trigger"
|
|
25
|
-
>
|
|
26
|
-
Actions <Icon name="keyboard_arrow_down" size={16} />
|
|
27
|
-
</Button>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
18
|
return (
|
|
31
|
-
<
|
|
32
|
-
trigger={trigger}
|
|
33
|
-
open={isOpen}
|
|
34
|
-
onClickOutside={() => setOpen(false)}
|
|
35
|
-
direction="bl"
|
|
36
|
-
className="qa-brand-card-action-menu"
|
|
37
|
-
>
|
|
19
|
+
<Menu label="Actions" className="qa-brand-card-action-menu" size="small">
|
|
38
20
|
{actions.map(action => {
|
|
39
21
|
const actionClick = () => {
|
|
40
|
-
setOpen(false);
|
|
41
22
|
if (action.action) {
|
|
42
23
|
action.action();
|
|
43
24
|
}
|
|
@@ -47,16 +28,15 @@ export const ActionsButtonSection: FC<{
|
|
|
47
28
|
};
|
|
48
29
|
|
|
49
30
|
return (
|
|
50
|
-
<
|
|
31
|
+
<Menu.Item
|
|
51
32
|
disabled={action.disabled}
|
|
52
33
|
key={action.name}
|
|
53
34
|
onClick={actionClick}
|
|
54
35
|
className="qa-brand-card-action-menu-item"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</ActionMenu.Item>
|
|
36
|
+
label={action.name}
|
|
37
|
+
/>
|
|
58
38
|
);
|
|
59
39
|
})}
|
|
60
|
-
</
|
|
40
|
+
</Menu>
|
|
61
41
|
);
|
|
62
42
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
|
|
4
|
-
import { Flex, Card } from '@servicetitan/anvil2';
|
|
4
|
+
import { Flex, Card, Avatar } from '@servicetitan/anvil2';
|
|
5
5
|
|
|
6
|
-
import { NameAndMailSection } from './name-and-mail-section';
|
|
7
6
|
import { BrandCardProps } from '../../../utils/interfaces';
|
|
8
7
|
import { ActionsButtonSection } from './actions-button-section';
|
|
9
|
-
import {
|
|
10
|
-
import { BrandLogo } from './brand-logo';
|
|
8
|
+
import { InfoSection } from './info-section';
|
|
11
9
|
|
|
12
10
|
import * as Styles from '../styles.module.less';
|
|
13
11
|
|
|
@@ -35,20 +33,28 @@ export const BrandCard: FC<BrandCardProps> = ({
|
|
|
35
33
|
)}
|
|
36
34
|
padding="large"
|
|
37
35
|
>
|
|
38
|
-
<Flex
|
|
36
|
+
<Flex
|
|
37
|
+
className={Styles.cardContent}
|
|
38
|
+
justifyContent="space-between"
|
|
39
|
+
direction="column"
|
|
40
|
+
gap="6"
|
|
41
|
+
>
|
|
39
42
|
<Flex
|
|
40
43
|
justifyContent="space-between"
|
|
41
44
|
alignItems="flex-start"
|
|
42
45
|
className="qa-brand-card-left-section"
|
|
43
46
|
>
|
|
44
|
-
<
|
|
47
|
+
<Avatar image={logo} name={nameToShow} size="large" />
|
|
45
48
|
<ActionsButtonSection actions={actions} />
|
|
46
49
|
</Flex>
|
|
47
50
|
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
<InfoSection
|
|
52
|
+
name={name}
|
|
53
|
+
nameToShow={nameToShow}
|
|
54
|
+
email={email}
|
|
55
|
+
isDefault={isDefault}
|
|
56
|
+
isShared={isShared}
|
|
57
|
+
/>
|
|
52
58
|
</Flex>
|
|
53
59
|
</Card>
|
|
54
60
|
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Chip, Flex, Text } from '@servicetitan/anvil2';
|
|
4
|
+
|
|
5
|
+
interface InfoSectionProps {
|
|
6
|
+
nameToShow: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
isDefault?: boolean;
|
|
10
|
+
isShared?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const InfoSection: FC<InfoSectionProps> = ({ nameToShow, email, isDefault, isShared }) => (
|
|
14
|
+
<Flex direction="column" gap="4">
|
|
15
|
+
<Flex direction="column" gap="1">
|
|
16
|
+
<Flex gap="2" alignItems="center">
|
|
17
|
+
<Text className="t-truncate-i m-0" title={nameToShow} variant="headline" el="h3">
|
|
18
|
+
{nameToShow}
|
|
19
|
+
</Text>
|
|
20
|
+
<Flex gap="1">
|
|
21
|
+
{isDefault && <Chip label="Default" />}
|
|
22
|
+
{isShared && <Chip color="#b5deff" label="Corporate HQ" />}
|
|
23
|
+
</Flex>
|
|
24
|
+
</Flex>
|
|
25
|
+
{email && (
|
|
26
|
+
<Text subdued title={email} className="t-truncate-i">
|
|
27
|
+
{email}
|
|
28
|
+
</Text>
|
|
29
|
+
)}
|
|
30
|
+
</Flex>
|
|
31
|
+
</Flex>
|
|
32
|
+
);
|
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
@card-max-width: 700px;
|
|
6
6
|
@max-number-of-cards: 3;
|
|
7
7
|
|
|
8
|
-
.delete-tooltip {
|
|
9
|
-
min-width: 327px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
8
|
.grid {
|
|
13
9
|
grid-template-columns: repeat(auto-fill, minmax(@card-min-width, 1fr));
|
|
14
10
|
max-width: calc(@card-max-width * @max-number-of-cards + @spacing-3 * 2);
|
|
@@ -27,7 +23,6 @@
|
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
.brand-card {
|
|
30
|
-
height: 200px;
|
|
31
26
|
min-width: @card-min-width;
|
|
32
27
|
max-width: @card-max-width;
|
|
33
28
|
}
|
|
@@ -36,24 +31,6 @@
|
|
|
36
31
|
width: 100%;
|
|
37
32
|
}
|
|
38
33
|
|
|
39
|
-
.card-left-section-texts {
|
|
40
|
-
min-width: 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.brand-img {
|
|
44
|
-
width: @spacing-6;
|
|
45
|
-
height: @spacing-6;
|
|
46
|
-
min-width: @spacing-6;
|
|
47
|
-
min-height: @spacing-6;
|
|
48
|
-
border-radius: @border-radius-circular;
|
|
49
|
-
border: solid 1px @color-neutral-60;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.brand-img-placeholder {
|
|
53
|
-
.brand-img();
|
|
54
|
-
background-color: @color-neutral-60;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
34
|
.card-with-error {
|
|
58
35
|
border-color: @color-red-500;
|
|
59
36
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
export const __esModule: true;
|
|
2
2
|
export const brandCard: string;
|
|
3
|
-
export const brandImg: string;
|
|
4
|
-
export const brandImgPlaceholder: string;
|
|
5
3
|
export const cardContent: string;
|
|
6
|
-
export const cardLeftSectionTexts: string;
|
|
7
4
|
export const cardWithError: string;
|
|
8
|
-
export const deleteTooltip: string;
|
|
9
5
|
export const grid: string;
|
|
10
6
|
|