Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

chore: enter-browser-data-in-console #127

Merged
merged 1 commit into from
Jun 10, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-console */

import { useEffect } from 'react'
import { useState } from 'react'

Expand All @@ -9,6 +11,13 @@ export const useHeroBackgroundColor: UseHeroBackgroundColorType = () => {

useEffect(() => {
const userAgent = navigator.userAgent.toLowerCase()
// @ts-ignore
const brands = navigator?.userAgentData?.brands.map((b) => b.brand)

console.log('BACKGROUND_COLOR:', color)
console.log('USER_AGENT:', userAgent)
console.log('USER_AGENT_DATA:', brands)

if (userAgent.indexOf(Browser.CHROME) > -1) {
setColor('background.purpleInChrome')
} else if (userAgent.indexOf(Browser.SAFARI) > -1) {
Expand All @@ -18,7 +27,7 @@ export const useHeroBackgroundColor: UseHeroBackgroundColorType = () => {
} else {
setColor('background.hero')
}
}, [])
}, [color])

return { heroBackgroundColor: color }
}
Loading