Skip to content

Commit

Permalink
Fix missing styles for demo-banner (#1179)
Browse files Browse the repository at this point in the history
  • Loading branch information
tu55eladd authored Aug 25, 2023
1 parent dba377f commit d13814e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "MIT",
"scripts": {
"dev": "vite",
"dev:gh-pages": "VITE_USE_HASH_ROUTER=true vite",
"build:dev-ekstern": "vite build --mode=dev-ekstern",
"build:dev-intern": "vite build --mode=dev-intern --base=https://cdn.nav.no/dab/aktivitetsplan-dev-intern/build/",
"build:prod-ekstern": "vite build --mode=prod-ekstern",
Expand Down
18 changes: 9 additions & 9 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import * as ReactDOM from 'react-dom';

import { initAmplitude } from './amplitude/amplitude';
import { ER_INTERN_FLATE, USE_MOCK } from './constant';
import DemoBanner from './mocks/demo/DemoBanner';
import {mockfnr} from "./mocks/utils";
import { mockfnr } from './mocks/utils';

setDefaultOptions({ locale: nn });

Expand All @@ -32,15 +31,16 @@ const renderApp = () => {
};

if (USE_MOCK) {
const webComponentTag = document.createElement("dab-aktivitetsplan")
webComponentTag.setAttribute("data-fnr", mockfnr)
document.getElementById("root")!!.appendChild(webComponentTag)
import('./mocks')
.then(({ default: startWorker }) => startWorker())
.then(() => {
const webComponentTag = document.createElement('dab-aktivitetsplan');
webComponentTag.setAttribute('data-fnr', mockfnr);
document.getElementById('root')?.appendChild(webComponentTag);
Promise.all([import('./mocks'), import('./mocks/demo/DemoBanner')]).then(
([{ default: startWorker }, { default: DemoBanner }]) => {
startWorker();
ReactDOM.render(<DemoBanner />, document.getElementById('demo'));
renderApp();
});
},
);
} else {
initAmplitude();
renderApp();
Expand Down
7 changes: 6 additions & 1 deletion src/mocks/demo/DemoBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { Modal } from '@navikt/ds-react';
import React, { useState } from 'react';

// CSS is imported twice when in demo mode to support switching between web-components and normal render
import '@navikt/ds-css';
import '../../tailwind.css';
import '../../index.less';

import DemoDashboard from './demoDashboard';
import DemoIkon from './DemoIkon';

Expand All @@ -9,7 +14,7 @@ const DemoBanner = () => {

return (
<div>
<DemoIkon alt="" onClick={() => setOpen(true)} />
<DemoIkon onClick={() => setOpen(true)} />
<Modal open={open} onClose={() => setOpen(false)}>
<DemoDashboard />
</Modal>
Expand Down

0 comments on commit d13814e

Please sign in to comment.