Skip to content

Commit

Permalink
feat: custom webfont selection on surveys
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasheriques committed Jan 10, 2025
1 parent f93a6e6 commit fdae3df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/extensions/surveys/surveys-utils.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PostHog } from '../../posthog-core'
import { Survey, SurveyAppearance, MultipleSurveyQuestion, SurveyQuestion } from '../../posthog-surveys-types'
import { window as _window, document as _document } from '../../utils/globals'
import { VNode, cloneElement, createContext } from 'preact'
import { PostHog } from '../../posthog-core'
import { MultipleSurveyQuestion, Survey, SurveyAppearance, SurveyQuestion } from '../../posthog-surveys-types'
import { document as _document, window as _window } from '../../utils/globals'
// We cast the types here which is dangerous but protected by the top level generateSurveys call
const window = _window as Window & typeof globalThis
const document = _document as Document
Expand All @@ -22,7 +22,7 @@ export const style = (appearance: SurveyAppearance | null) => {
bottom: 0px;
color: black;
font-weight: normal;
font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-family: ${appearance?.fontFamily || '-apple-system'}, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
text-align: left;
max-width: ${parseInt(appearance?.maxWidth || '300')}px;
width: 100%;
Expand All @@ -36,7 +36,7 @@ export const style = (appearance: SurveyAppearance | null) => {
border-top-right-radius: 10px;
box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);
}
.survey-box, .thank-you-message-container {
padding: 20px 25px 10px;
display: flex;
Expand All @@ -56,7 +56,7 @@ export const style = (appearance: SurveyAppearance | null) => {
.survey-form textarea {
color: #2d2d2d;
font-size: 14px;
font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-family: ${appearance?.fontFamily || '-apple-system'}, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
background: white;
color: black;
outline: none;
Expand Down
1 change: 1 addition & 0 deletions src/posthog-surveys-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface SurveyAppearance {
widgetSelector?: string
widgetLabel?: string
widgetColor?: string
fontFamily?: string
// questionable: Not in frontend/src/types.ts -> SurveyAppearance, but used in site app
maxWidth?: string
zIndex?: string
Expand Down

0 comments on commit fdae3df

Please sign in to comment.