Skip to content

Commit ead7ae7

Browse files
committed
new config
1 parent 8a614f0 commit ead7ae7

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

packages/feedback/src/constants/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
99
export const DOCUMENT = WINDOW.document;
1010
export const NAVIGATOR = WINDOW.navigator;
1111

12-
export const ACTOR_LABEL = 'Report a Bug';
12+
export const ACTOR_LABEL = { desktop: 'Report a Bug', mobile: '' };
1313
export const CANCEL_BUTTON_LABEL = 'Cancel';
1414
export const SUBMIT_BUTTON_LABEL = 'Send Bug Report';
1515
export const FORM_TITLE = 'Report a Bug';

packages/feedback/src/constants/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const LIGHT_THEME = {
1010
backgroundHover: '#f6f6f7',
1111
foreground: '#2b2233',
1212
border: '1.5px solid rgba(41, 35, 47, 0.13)',
13-
borderRadius: '99px',
13+
borderRadius: '25px',
1414
boxShadow: '0px 4px 24px 0px rgba(43, 34, 51, 0.12)',
1515

1616
success: '#268d75',

packages/feedback/src/core/components/Actor.css.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ export function createActorStyles(): HTMLStyleElement {
5656
.widget__actor__text {
5757
}
5858
59-
@media (max-width: 600px) {
60-
.widget__actor__text {
61-
display: none;
62-
}
63-
}
64-
6559
.feedback-icon path {
6660
fill: var(--foreground);
6761
}

packages/feedback/src/core/integration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { Actor } from './components/Actor';
3131
import { createMainStyles } from './createMainStyles';
3232
import { sendFeedback } from './sendFeedback';
3333
import type { OptionalFeedbackConfiguration, OverrideFeedbackConfiguration } from './types';
34+
import { isMobile } from '../util/isMobile';
3435

3536
type Unsubscribe = () => void;
3637

@@ -217,7 +218,7 @@ export const feedbackIntegration = (({
217218

218219
const autoInjectActor = (): void => {
219220
const shadow = _createShadow(_options);
220-
const actor = Actor({ buttonLabel: _options.buttonLabel, shadow });
221+
const actor = Actor({ buttonLabel: (typeof _options.buttonLabel === 'object' ? (isMobile() ? _options.buttonLabel.mobile : _options.buttonLabel.desktop) : _options.buttonLabel), shadow });
221222
const mergedOptions = mergeOptions(_options, {
222223
onFormOpen() {
223224
actor.removeFromDom();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { NAVIGATOR } from '../constants';
2+
/**
3+
* Returns if it's a mobile browser
4+
*/
5+
export function isMobile(): boolean {
6+
return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(NAVIGATOR.userAgent));
7+
}

packages/feedback/src/util/isScreenshotSupported.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { NAVIGATOR } from '../constants';
1+
import { isMobile } from './isMobile';
22

33
/**
44
* Mobile browsers do not support `mediaDevices.getDisplayMedia` even though they have the api implemented
@@ -14,7 +14,7 @@ import { NAVIGATOR } from '../constants';
1414
* https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia
1515
*/
1616
export function isScreenshotSupported(): boolean {
17-
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(NAVIGATOR.userAgent)) {
17+
if (isMobile()) {
1818
return false;
1919
}
2020
if (!isSecureContext) {

packages/types/src/feedback/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export interface FeedbackTextConfiguration {
8484
/**
8585
* The label for the Feedback widget button that opens the dialog
8686
*/
87-
buttonLabel: string;
87+
buttonLabel: string | { desktop: string; mobile: string};
8888

8989
/**
9090
* The label for the Feedback form cancel button that closes dialog

0 commit comments

Comments
 (0)