Skip to content

Commit

Permalink
chore: Update dark theme logos styling (Fixes #1209) (#1213)
Browse files Browse the repository at this point in the history
* chore: Update dark theme logos styling

* replaced var with let

* Replaced var with let - 2

* Applied suggestions from code review

Co-authored-by: Gabriel Jablonski <gabriel.g.jablonski@gmail.com>

* changed in approach. added a new key in Svg component.

* ran prettier

---------

Co-authored-by: Gabriel Jablonski <gabriel.g.jablonski@gmail.com>
  • Loading branch information
rahulharpal1603 and gabrieljablonski authored Jul 26, 2024
1 parent 143221a commit 2172242
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/components/AdsContainer/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
width: 100%;
max-width: 341px;
}
}
}
2 changes: 1 addition & 1 deletion docs/src/components/BannerSponsor/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

.sponsor-banner-silver {
max-width: 163px;
}
}
12 changes: 10 additions & 2 deletions docs/src/components/HomepageFeatures/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/require-default-props */
/* eslint-disable import/no-unresolved */
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable global-require */
Expand All @@ -9,6 +10,7 @@ type FeatureItem = {
title: string
Svg: React.ComponentType<React.ComponentProps<'svg'>>
description: JSX.Element
allowsDarkMode?: boolean
}

const FeatureList: FeatureItem[] = [
Expand All @@ -28,6 +30,7 @@ const FeatureList: FeatureItem[] = [
community to always try to improve ReactTooltip.
</>
),
allowsDarkMode: true,
},
{
title: 'Focus on What Matters',
Expand All @@ -41,11 +44,16 @@ const FeatureList: FeatureItem[] = [
},
]

function Feature({ title, Svg, description }: FeatureItem) {
function Feature({ title, Svg, description, allowsDarkMode }: FeatureItem) {
return (
<div className={clsx('col col--4')}>
<div className="text--center">
<Svg className={styles.featureSvg} role="img" />
<Svg
className={clsx(styles.featureSvg, {
[styles.svgDarkMode]: allowsDarkMode,
})}
role="img"
/>
</div>
<div className="text--center padding-horiz--md">
<h3>{title}</h3>
Expand Down
4 changes: 4 additions & 0 deletions docs/src/components/HomepageFeatures/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
height: 200px;
width: 200px;
}

html[data-theme='dark'] .svgDarkMode {
fill: #fff;
}
11 changes: 9 additions & 2 deletions docs/src/components/HomepageSponsored/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type FeatureItem = {
// eslint-disable-next-line react/no-unused-prop-types
eventTitle?: string
link: string
allowsDarkMode?: boolean
}

type SponsorItem = FeatureItem & {
Expand All @@ -30,6 +31,7 @@ const FeatureList: FeatureItem[] = [
title: 'Algolia',
Svg: require('@site/static/img/Algolia-logo.svg').default,
link: 'https://docsearch.algolia.com/',
allowsDarkMode: true,
},
]

Expand All @@ -50,12 +52,17 @@ const SponsorList: SponsorItem[] = [
// },
]

function Feature({ title, Svg, link }: FeatureItem) {
function Feature({ title, Svg, link, allowsDarkMode }: FeatureItem) {
return (
<div className={clsx('col col--6')}>
<div className="text--center">
<a href={link} title={title} target="_blank" rel="noreferrer" aria-label={title}>
<Svg className={styles.featureSvg} role="img" />
<Svg
className={clsx(styles.featureSvg, {
[styles.svgDarkMode]: allowsDarkMode,
})}
role="img"
/>
</a>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions docs/src/components/HomepageSponsored/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@
width: 100%;
}
}

html[data-theme='dark'] .svgDarkMode {
fill: #fff;
}
2 changes: 1 addition & 1 deletion docs/static/img/Algolia-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2172242

Please sign in to comment.