Skip to content

Commit

Permalink
fix: use Script cmp instead of custom hook
Browse files Browse the repository at this point in the history
  • Loading branch information
MaGOs92 committed Jan 4, 2024
1 parent 845e16a commit 1964d3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
18 changes: 0 additions & 18 deletions hooks/bal-widget.js

This file was deleted.

7 changes: 4 additions & 3 deletions pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import {init as matomoInit} from '@socialgouv/matomo-next'

import '@/styles/template-data-gouv-to-dsfr/normalizer.css'
import '@/styles/template-data-gouv-to-dsfr/main-alternate.css'
import { useBALWidget } from '@/hooks/bal-widget'
import Script from 'next/script'

const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID
const BAL_WIDGET_URL = process.env.NEXT_PUBLIC_BAL_WIDGET_URL

const {
withDsfr,
Expand All @@ -27,8 +28,6 @@ export {dsfrDocumentApi}
function MyApp({Component, pageProps}) {
const {setIsDark} = useIsDark()

useBALWidget()

useEffect(() => {
setIsDark(false)
}, [setIsDark])
Expand All @@ -46,6 +45,8 @@ function MyApp({Component, pageProps}) {
<div id='alert-root' />
<Component {...pageProps} />
</DeviceContextProvider>
{BAL_WIDGET_URL && (
<Script src={`${BAL_WIDGET_URL}/bal-widget.js`} strategy='lazyOnload' />)}
<style global jsx>{`
body,
html,
Expand Down

0 comments on commit 1964d3e

Please sign in to comment.