Skip to content

Commit 4150a12

Browse files
authored
fix(NOJIRA-123): Update embed icons (#686)
* fix(NOJIRA-123): Update embed icons * chore(NOJIRA-123): Update github actions checkout version * chore(NOJIRA-123): Update github actions cache version * chore(NOJIRA-123): Fix close icon color on mobile view
1 parent b18ab33 commit 4150a12

File tree

12 files changed

+58
-34
lines changed

12 files changed

+58
-34
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v4
3939

4040
# Initializes the CodeQL tools for scanning.
4141
- name: Initialize CodeQL

.github/workflows/pull-request.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
name: build-lint-test - node ${{ matrix.node_version }}
1717
steps:
1818
- name: Check out Git repository
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
2020

2121
- name: Set up Node.js
2222
uses: actions/setup-node@v3
2323
with:
2424
node-version: ${{ matrix.node_version }}
2525

2626
- name: Get yarn cache
27-
uses: actions/cache@v2
27+
uses: actions/cache@v4
2828
id: yarn-cache
2929
with:
3030
path: |
@@ -58,15 +58,15 @@ jobs:
5858
runs-on: ubuntu-latest
5959
steps:
6060
- name: Check out Git repository
61-
uses: actions/checkout@v2
61+
uses: actions/checkout@v4
6262

6363
- name: Set up Node.js
6464
uses: actions/setup-node@v3
6565
with:
6666
node-version: 20
6767

6868
- name: Get yarn cache
69-
uses: actions/cache@v2
69+
uses: actions/cache@v4
7070
id: yarn-cache
7171
with:
7272
path: |
@@ -87,16 +87,15 @@ jobs:
8787
if: github.event.pull_request.head.repo.full_name == github.repository
8888
steps:
8989
- name: Check out Git repository
90-
uses:
91-
actions/checkout@v3
90+
uses: actions/checkout@v4
9291

9392
- name: Set up Node.js
9493
uses: actions/setup-node@v3
9594
with:
9695
node-version: 20
9796

9897
- name: Get yarn cache
99-
uses: actions/cache@v2
98+
uses: actions/cache@v4
10099
id: yarn-cache
101100
with:
102101
path: |

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Check out Git repository
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414
with:
1515
fetch-depth: 0
1616
# Use custom token from repo secrets to allow semantic release to push commit:
@@ -24,7 +24,7 @@ jobs:
2424
node-version: 20
2525

2626
- name: Get yarn cache
27-
uses: actions/cache@v3
27+
uses: actions/cache@v4
2828
id: yarn-cache
2929
with:
3030
path: |

.github/workflows/visual.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
if: ${{ !github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository }}
1414
steps:
1515
- name: Check out Git repository
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717

1818
- name: Set up Node.js
1919
uses: actions/setup-node@v3
2020
with:
2121
node-version: 20
2222

2323
- name: Get yarn cache
24-
uses: actions/cache@v2
24+
uses: actions/cache@v4
2525
id: yarn-cache
2626
with:
2727
path: |

packages/embed/src/css/popover.scss

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,26 @@
120120
}
121121

122122
&-close {
123-
color: rgba(0, 0, 0, 0.2);
124123
cursor: pointer;
125124
margin-left: 4px;
126125
display: inline-block;
127-
width: 20px;
128-
height: 20px;
129-
font-size: 18px;
130126
text-align: center;
131127
position: absolute;
132-
top: 8px;
128+
top: 12px;
133129
right: 6px;
134130

135-
&:hover {
136-
color: rgba(0, 0, 0, 0.3);
131+
svg {
132+
width: 20px;
133+
height: 20px;
134+
}
135+
136+
svg path {
137+
fill: rgba(0, 0, 0, 0.2);
138+
transition: fill 150ms ease-in-out;
139+
}
140+
141+
&:hover svg path {
142+
fill: rgba(0, 0, 0, 0.3);
137143
}
138144
}
139145

packages/embed/src/factories/create-popover/create-popover.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
invokeWithoutDefault,
1212
addAttributesToElement,
1313
handlePreventReopenOnClose,
14+
closeIconSvg,
15+
triggerIconSvg,
1416
} from '../../utils'
1517
import type { RemoveHandler } from '../../utils'
1618
import { ButtonProps, EmbedPopup } from '../../base'
@@ -38,7 +40,7 @@ const buildPopover = (width?: number | string, height?: number | string) => {
3840
const buildCloseIcon = (element = 'span', className = 'tf-v1-popover-button-icon') => {
3941
const icon = document.createElement(element)
4042
icon.className = `${className} tf-v1-close-icon`
41-
icon.innerHTML = '×'
43+
icon.innerHTML = closeIconSvg
4244
icon.dataset.testid = className
4345
return icon
4446
}
@@ -65,13 +67,7 @@ const buildIcon = (customIcon?: string, color?: string) => {
6567
const triggerIcon = document.createElement('div')
6668
triggerIcon.className = 'tf-v1-popover-button-icon'
6769

68-
const svgIcon = `<svg class="default" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
69-
<path d="M21 0H0V9L10.5743 24V16.5H21C22.6567 16.5 24 15.1567 24 13.5V3C24 1.34325 22.6567 0 21 0ZM7.5
70-
9.75C6.672 9.75 6 9.07875 6 8.25C6 7.42125 6.672 6.75 7.5 6.75C8.328 6.75 9 7.42125 9 8.25C9 9.07875 8.328 9.75
71-
7.5 9.75ZM12.75 9.75C11.922 9.75 11.25 9.07875 11.25 8.25C11.25 7.42125 11.922 6.75 12.75 6.75C13.578 6.75 14.25
72-
7.42125 14.25 8.25C14.25 9.07875 13.578 9.75 12.75 9.75ZM18 9.75C17.172 9.75 16.5 9.07875 16.5 8.25C16.5 7.42125
73-
17.172 6.75 18 6.75C18.828 6.75 19.5 7.42125 19.5 8.25C19.5 9.07875 18.828 9.75 18 9.75Z" fill="${fillColor}"></path>
74-
</svg>`
70+
const svgIcon = triggerIconSvg(fillColor)
7571

7672
const isUrlIcon = customIcon?.startsWith('http')
7773
triggerIcon.innerHTML = isUrlIcon
@@ -97,7 +93,7 @@ const buildTooltip = (message: string, hide: () => void) => {
9793
const icon = document.createElement('span')
9894
icon.className = 'tf-v1-popover-tooltip-close'
9995
icon.dataset.testid = 'tf-v1-popover-tooltip-close'
100-
icon.innerHTML = '&times;'
96+
icon.innerHTML = closeIconSvg
10197
icon.onclick = hide
10298

10399
const textContainer = document.createElement('div')

packages/embed/src/factories/create-popup/create-popup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
addCustomKeyboardListener,
1010
invokeWithoutDefault,
1111
handlePreventReopenOnClose,
12+
closeIconSvg,
1213
} from '../../utils'
1314
import type { RemoveHandler } from '../../utils'
1415
import { POPUP_SIZE } from '../../constants'
@@ -51,7 +52,7 @@ const buildWrapper = (width?: number | string, height?: number | string, size?:
5152
const buildCloseButton = (close: () => void) => {
5253
const closeButton = document.createElement('button')
5354
closeButton.className = 'tf-v1-close tf-v1-close-icon'
54-
closeButton.innerHTML = '&times;'
55+
closeButton.innerHTML = closeIconSvg
5556
closeButton.ariaLabel = 'Close'
5657
closeButton.onclick = invokeWithoutDefault(close)
5758
return closeButton

packages/embed/src/factories/create-sidetab/create-sidetab.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
addAttributesToElement,
1313
getValueWithUnits,
1414
handlePreventReopenOnClose,
15+
closeIconSvg,
16+
triggerIconSvg,
1517
} from '../../utils'
1618
import type { RemoveHandler } from '../../utils'
1719
import { ButtonProps, EmbedPopup } from '../../base'
@@ -125,9 +127,7 @@ const buildIcon = (customIcon?: string, backgroundColor?: string, textColor?: st
125127
triggerIcon.style.height = getValueWithUnits(size)
126128
}
127129

128-
const svgIcon = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
129-
<path d="M21 0H0V9L10.5743 24V16.5H21C22.6567 16.5 24 15.1567 24 13.5V3C24 1.34325 22.6567 0 21 0ZM7.5 9.75C6.672 9.75 6 9.07875 6 8.25C6 7.42125 6.672 6.75 7.5 6.75C8.328 6.75 9 7.42125 9 8.25C9 9.07875 8.328 9.75 7.5 9.75ZM12.75 9.75C11.922 9.75 11.25 9.07875 11.25 8.25C11.25 7.42125 11.922 6.75 12.75 6.75C13.578 6.75 14.25 7.42125 14.25 8.25C14.25 9.07875 13.578 9.75 12.75 9.75ZM18 9.75C17.172 9.75 16.5 9.07875 16.5 8.25C16.5 7.42125 17.172 6.75 18 6.75C18.828 6.75 19.5 7.42125 19.5 8.25C19.5 9.07875 18.828 9.75 18 9.75Z" fill="${fillColor}"></path>
130-
</svg>`
130+
const svgIcon = triggerIconSvg(fillColor)
131131

132132
const isUrlIcon = customIcon?.startsWith('http')
133133
triggerIcon.innerHTML = isUrlIcon
@@ -141,7 +141,7 @@ const buildIcon = (customIcon?: string, backgroundColor?: string, textColor?: st
141141
const buildCloseIcon = (element = 'div', className = 'tf-v1-sidetab-button-icon') => {
142142
const closeButton = document.createElement(element)
143143
closeButton.className = `${className} tf-v1-close-icon`
144-
closeButton.innerHTML = '&times;'
144+
closeButton.innerHTML = closeIconSvg
145145
closeButton.dataset.testid = className
146146
return closeButton
147147
}

packages/embed/src/factories/create-slider/create-slider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
isInPage,
1111
invokeWithoutDefault,
1212
handlePreventReopenOnClose,
13+
closeIconSvg,
1314
} from '../../utils'
1415
import type { RemoveHandler } from '../../utils'
1516
import { SLIDER_POSITION, SLIDER_WIDTH } from '../../constants'
@@ -45,7 +46,7 @@ const buildWrapper = (position: Position, width: number | string) => {
4546
const buildCloseButton = (close: () => void) => {
4647
const closeButton = document.createElement('button')
4748
closeButton.className = 'tf-v1-close tf-v1-close-icon'
48-
closeButton.innerHTML = '&times;'
49+
closeButton.innerHTML = closeIconSvg
4950
closeButton.ariaLabel = 'Close'
5051
closeButton.onclick = invokeWithoutDefault(close)
5152
return closeButton
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const closeIconSvg = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.293 4.293a1 1 0 0 1 1.414 0L12 10.586l6.293-6.293a1 1 0 1 1 1.414 1.414L13.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414L12 13.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L10.586 12 4.293 5.707a1 1 0 0 1 0-1.414Z" fill="currentColor"/>
3+
</svg>`

packages/embed/src/utils/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ export * from './change-color-opacity'
1818
export * from './hubspot'
1919
export * from './invoke-without-default'
2020
export * from './add-attributes-to-element'
21+
export * from './close-icon-svg'
22+
export * from './trigger-icon-svg'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export const triggerIconSvg = (
2+
fillColor: string
3+
) => `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4+
<path
5+
fill-rule="evenodd"
6+
clip-rule="evenodd"
7+
d="M2.002 5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6.697l-5.748 3.832A1 1 0 0 1 6.002 22v-3h-2a2 2 0 0 1-2-2V5Zm18 0h-16v12h3a1 1 0 0 1 1 1v2.131l4.445-2.963a1 1 0 0 1 .555-.168h7V5Z"
8+
fill=${fillColor}
9+
/>
10+
<path
11+
fill-rule="evenodd"
12+
clip-rule="evenodd"
13+
d="M7.5 12.25a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5Zm4.5 0a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5Zm4.5 0a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5Z"
14+
fill=${fillColor}
15+
/>
16+
</svg>`

0 commit comments

Comments
 (0)