Skip to content

Dopt sponsorship #1097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ yarn add react-tooltip

React Tooltip is proud to be sponsored by [Frigade](https://frigade.com/?source=react-tooltip), a developer tool for building better product onboarding: guided tours, getting started checklists, announcements, etc.

<a href="https://dopt.com/?source=react-tooltip">
<img alt="Dopt" style="height: 250px" src="docs/static/img/sponsors/dopt.png" />
</a>

[Dopt](https://dopt.com/?source=react-tooltip) gives developers UI components and SDKs to build seamless onboarding and education experiences in minutes.

## Usage

1 . Import the CSS file to set default styling.
Expand Down
9 changes: 5 additions & 4 deletions docs/src/components/AdsContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/* eslint-disable import/no-unresolved */
import React from 'react'
import AdsContainerElement from '@site/src/components/AdsContainerElement'
import BannerFrigade from '@site/src/components/BannerFrigade'
// import AdsContainerElement from '@site/src/components/AdsContainerElement'
import BannerSponsor from '@site/src/components/BannerSponsor'
import './styles.css'

const AdsContainer = () => {
return (
<div className="fixed">
<BannerFrigade />
<AdsContainerElement />
<BannerSponsor sponsorKey="frigade" />
<BannerSponsor sponsorKey="dopt" />
{/* <AdsContainerElement /> */}
</div>
)
}
Expand Down
42 changes: 0 additions & 42 deletions docs/src/components/BannerFrigade/index.tsx

This file was deleted.

64 changes: 64 additions & 0 deletions docs/src/components/BannerSponsor/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* eslint-disable import/no-unresolved */
import React from 'react'
// @ts-ignore
import LogoFrigade from '@site/static/img/sponsors/frigade.png'
// @ts-ignore
import LogoDopt from '@site/static/img/sponsors/dopt.png'
import './styles.css'

declare global {
interface Window {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
dataLayer?: any
}
}

const SPONSORS = {
frigade: {
logo: LogoFrigade,
title: 'Frigade',
href: 'https://frigade.com/',
},
dopt: {
logo: LogoDopt,
title: 'Dopt',
href: 'https://dopt.com/',
},
}

interface BannerSponsorProps {
sponsorKey: keyof typeof SPONSORS
}

const BannerSponsor = ({ sponsorKey }: BannerSponsorProps) => {
const sponsor = SPONSORS[sponsorKey]

const onClickSponsorBannerEventHandler = () => {
if (typeof window !== 'undefined') {
window.dataLayer = window.dataLayer || []

window.dataLayer.push({
event: `click_${sponsorKey}_banner`,
place: 'sidebar',
})
}

return true
}

return (
<div className="sponsor-banner">
<a
href={`${sponsor.href}?source=react-tooltip`}
title={sponsor.title}
target="_blank"
rel="noreferrer"
onClick={onClickSponsorBannerEventHandler}
>
<img src={sponsor.logo} alt={sponsor.title} />
</a>
</div>
)
}

export default BannerSponsor
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.sponsor-frigade {
.sponsor-banner {
/* same as `--carbon-max-char` */
--frigade-max-char: 20ch;
--sponsor-max-char: 20ch;
display: flex;
flex-direction: column;
min-inline-size: 130px;
max-inline-size: calc(130px + var(--frigade-max-char) + 8ch);
max-inline-size: calc(130px + var(--sponsor-max-char) + 8ch);
max-width: 377px;
}
12 changes: 9 additions & 3 deletions docs/src/components/HomepageSponsored/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ const SponsorList: FeatureItem[] = [
link: 'https://frigade.com/?source=react-tooltip',
eventTitle: 'frigade',
},
{
title: 'Dopt',
src: require('@site/static/img/sponsors/dopt.png').default,
link: 'https://dopt.com/?source=react-tooltip',
eventTitle: 'dopt',
},
]

function Feature({ title, Svg, link }: FeatureItem) {
Expand All @@ -51,7 +57,7 @@ function Feature({ title, Svg, link }: FeatureItem) {
}

export default function HomepageSponsored(): JSX.Element {
const onClickFrigadeBannerEventHandler = (title: string) => {
const onClickSponsorBannerEventHandler = (title: string) => {
if (typeof window !== 'undefined') {
window.dataLayer = window.dataLayer || []

Expand All @@ -71,15 +77,15 @@ export default function HomepageSponsored(): JSX.Element {
<div className="row">
{SponsorList.map(({ link, title, src, eventTitle }, idx) => (
// eslint-disable-next-line react/no-array-index-key
<div key={idx} className={clsx('col col--12')}>
<div key={idx} className={clsx(`col col--${12 / SponsorList.length}`)}>
<div className="text--center">
<a
href={link}
title={title}
target="_blank"
rel="noreferrer"
onClick={() => {
onClickFrigadeBannerEventHandler(eventTitle)
onClickSponsorBannerEventHandler(eventTitle)
}}
>
<img src={src} alt={title} width={480} />
Expand Down
Binary file added docs/static/img/sponsors/dopt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.