Skip to content

Commit eb08a1f

Browse files
committed
feat: new component "connection"
1 parent 9bb6435 commit eb08a1f

File tree

7 files changed

+96
-26
lines changed

7 files changed

+96
-26
lines changed

docs-site/src/pages/pattern-lab/_patterns/04-pages/99999-bolt-dev-sandbox/interactive-pathway-fragments/_pathwayOne.twig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
character-left-url="https://github.com/basaltinc/temp-pega-dummy-assets/raw/master/customer-neutral.png"
2020
character-right-url="https://github.com/basaltinc/temp-pega-dummy-assets/raw/master/pega-rep.png"
2121
>
22+
<span slot="connection">
23+
<bolt-connection
24+
connection-url="https://github.com/basaltinc/temp-pega-dummy-assets/raw/master/animated-bands-ltr.png"
25+
>
26+
<span slot="top">
27+
<bolt-text>Top slot</bolt-text>
28+
</span>
29+
<span slot="bottom">
30+
<bolt-text>Bottom slot</bolt-text>
31+
</span>
32+
</bolt-connection>
33+
</span>
2234
</bolt-two-character-chat>
2335
</span>
2436
<bolt-text tag="p" style="margin-bottom: 0;" slot="dialogue"><span style="color: black;">Why is my bill so high?</span></bolt-text>

packages/components/bolt-interactive-step/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ polyfillLoader.then(res => {
77
import(
88
/* webpackMode: 'eager', webpackChunkName: 'bolt-two-character-chat' */ './src/two-character-chat'
99
);
10+
import(
11+
/* webpackMode: 'eager', webpackChunkName: 'bolt-connection' */ './src/connection'
12+
);
1013
});
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import { props, define, hasNativeShadowDomSupport } from '@bolt/core/utils';
2+
import { withLitHtml, html } from '@bolt/core';
3+
import classNames from 'classnames/bind';
4+
import styles from './connection.scss';
5+
6+
let cx = classNames.bind(styles);
7+
8+
@define
9+
class BoltTwoCharacterChat extends withLitHtml() {
10+
static is = 'bolt-connection';
11+
12+
static props = {
13+
noShadow: {
14+
...props.boolean,
15+
...{ default: false },
16+
},
17+
connectionUrl: {
18+
...props.string,
19+
...{
20+
default:
21+
'https://github.com/basaltinc/temp-pega-dummy-assets/raw/master/animated-bands-ltr.png',
22+
},
23+
},
24+
};
25+
26+
// https://github.com/WebReflection/document-register-element#upgrading-the-constructor-context
27+
constructor(self) {
28+
self = super(self);
29+
self.useShadow = hasNativeShadowDomSupport;
30+
return self;
31+
}
32+
33+
render() {
34+
const {
35+
connectionUrl,
36+
} = this.validateProps(this.props);
37+
const classes = cx('c-bolt-connection');
38+
39+
return html`
40+
${this.addStyles([styles])}
41+
<div class="${classes}" is="shadow-root">
42+
<span class="c-bolt-connection__top-slot">
43+
${this.slot('top')}
44+
</span>
45+
<img
46+
class="c-bolt-connection__main-image"
47+
src="${connectionUrl}"
48+
alt="Connection Band"
49+
/>
50+
<span class="c-bolt-connection__bottom-slot">
51+
${this.slot('bottom')}
52+
</span>
53+
</div>
54+
`;
55+
}
56+
}
57+
58+
export { BoltTwoCharacterChat };
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.c-bolt-connection {
2+
display: flex;
3+
justify-content: center;
4+
align-items: center;
5+
flex-direction: column;
6+
position: relative;
7+
8+
&__main-image {
9+
//@todo Height will probably need to be exposed as an adjustable field to match the various sizes of the character elements
10+
width: 350px;
11+
height: 60px;
12+
}
13+
14+
&__top-slot {
15+
margin-bottom: 10px;
16+
}
17+
18+
&__bottom-slot {
19+
margin-top: 10px;
20+
}
21+
}

packages/components/bolt-interactive-step/src/interactive-step.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,6 @@ class BoltInteractiveStep extends withLitHtml() {
2727
...props.boolean,
2828
...{ default: false },
2929
},
30-
hideInteractionAnimations: {
31-
...props.boolean,
32-
...{ default: false },
33-
},
34-
customerDisposition: {
35-
...props.string,
36-
...{ default: 'happy' },
37-
},
38-
speakerPosition: {
39-
...props.string,
40-
...{ default: 'left' },
41-
},
4230
};
4331

4432
// https://github.com/WebReflection/document-register-element#upgrading-the-constructor-context
@@ -49,13 +37,11 @@ class BoltInteractiveStep extends withLitHtml() {
4937
}
5038

5139
render() {
52-
const { step, customerDisposition } = this;
5340
// validate the original prop data passed along -- returns back the validated data w/ added default values
5441
const {
5542
disabled,
5643
active,
57-
hideInteractionAnimations,
58-
speakerPosition,
44+
step,
5945
} = this.validateProps(this.props);
6046

6147
const classes = cx('c-bolt-interactive-step', {

packages/components/bolt-interactive-step/src/two-character-chat.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ class BoltTwoCharacterChat extends withLitHtml() {
6868
src="${characterLeftUrl}"
6969
alt="Character on the left"
7070
/>
71-
<img
72-
class="c-bolt-two-character-chat__connection"
73-
src="${connectionUrl}"
74-
alt="Connection Band"
75-
/>
71+
${this.slot('connection')}
7672
<img
7773
class="c-bolt-two-character-chat__character c-bolt-two-character-chat__character--right"
7874
src="${characterRightUrl}"

packages/components/bolt-interactive-step/src/two-character-chat.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,4 @@
2020
transform: translateX(-50%);
2121
}
2222
}
23-
24-
&__connection {
25-
//@todo Height will probably need to be exposed as an adjustable field to match the various sizes of the character elements
26-
width: 350px;
27-
height: 60px;
28-
}
2923
}

0 commit comments

Comments
 (0)