Skip to content

Commit

Permalink
Web Push prompt button styling fix (#281)
Browse files Browse the repository at this point in the history
* prompt button style fix

* prompt css fix

* Fixed image styling
  • Loading branch information
KambleSonam authored Oct 16, 2024
1 parent b7139a7 commit a604726
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
10 changes: 3 additions & 7 deletions clevertap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clevertap.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clevertap.min.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions src/modules/webPushPrompt/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@ export const createNotificationBox = (configData) => {
const pnCard = createElementWithAttributes('div', { id: 'pnCard' })

const iconTitleDescWrapper = createElementWithAttributes('div', { id: 'iconTitleDescWrapper' })
const iconContainer = createElementWithAttributes('div', { id: 'iconContainer' })
const imgElement = createElementWithAttributes('img', {
id: 'imgElement',
const iconContainer = createElementWithAttributes('img', {
id: 'iconContainer',
src: content.icon.type === 'default' ? `data:image/svg+xml;base64,${PROMPT_BELL_BASE64}` : content.icon.url
})

iconContainer.appendChild(imgElement)
iconTitleDescWrapper.appendChild(iconContainer)

const titleDescWrapper = createElementWithAttributes('div', { id: 'titleDescWrapper' })
Expand Down
18 changes: 13 additions & 5 deletions src/modules/webPushPrompt/promptStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const getBoxPromptStyles = (style) => {
border-color: ${style.card.border.borderColor};
border-style: solid;
` : ''}
height: fit-content;
}
#iconTitleDescWrapper {
Expand All @@ -40,9 +41,11 @@ export const getBoxPromptStyles = (style) => {
gap: 12px;
}
#imgElement {
#iconContainer {
min-width: 64px;
max-width: 64px;
max-height: 64px;
aspect-ratio: 1;
object-fit: cover;
}
#titleDescWrapper {
Expand All @@ -69,18 +72,23 @@ export const getBoxPromptStyles = (style) => {
#buttonsContainer {
display: flex;
justify-content: space-between;
height: 32px;
min-height: 32px;
gap: 8px;
align-items: center;
}
#primaryButton, #secondaryButton {
padding: 16px;
padding: 6px 24px;
flex: 1;
cursor: pointer;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
height: max-content;
font-size: 14px;
font-weight: 500;
line-height: 20px;
}
#primaryButton {
Expand All @@ -100,7 +108,7 @@ export const getBoxPromptStyles = (style) => {
background-color: ${style.buttons.secondaryButton.buttonColor};
color: ${style.buttons.secondaryButton.textColor};
border-radius: ${style.buttons.secondaryButton.borderRadius}px;
${style.buttons.primaryButton.borderEnabled
${style.buttons.secondaryButton.borderEnabled
? `
border-width: ${style.buttons.secondaryButton.border.borderWidth}px;
border-color: ${style.buttons.secondaryButton.border.borderColor};
Expand Down

0 comments on commit a604726

Please sign in to comment.