Skip to content

Commit

Permalink
fix website build
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemhosny committed Sep 5, 2024
1 parent b53cac4 commit 3d2fd00
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion website/docs/documentation/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ See the guide on [`chart controls`](../guides/chart-controls.md) for other alter

### dataShape

Instruction whether the data shape is <a href="https://en.wikipedia.org/wiki/Wide_and_narrow_data" target="_blank">"long" or "wide"</a>. By default, the library tries to detect the data shape automatically from its structure (after any [transformation](#dataTransform), by finding the columns `date`, `name` and `value`). If the data shape is not detected correctly, it can be manually specified.
Instruction whether the data shape is <a href="https://en.wikipedia.org/wiki/Wide_and_narrow_data" target="_blank">"long" or "wide"</a>. By default, the library tries to detect the data shape automatically from its structure (after any [transformation](#datatransform), by finding the columns `date`, `name` and `value`). If the data shape is not detected correctly, it can be manually specified.
See ["Data" section](./data.md) for more details and examples.

- Type: `"long" | "wide" | "auto"`
Expand Down
5 changes: 0 additions & 5 deletions website/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ This is a basic chart with the default options

<p style={{height: 30}}> </p>

export const transformFn = (data) => data.map((d) => ({
...d,
icon: `https://flagsapi.com/${d.code}/flat/64.png`,
}));

Try playing with some of the [options](./documentation/options.md). Or check the code [playground](./playground).

<div className="gallery">
Expand Down
3 changes: 2 additions & 1 deletion website/src/components/ChartOptions/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line import/no-unresolved
import { baseUrl } from '@site/src/helpers/base-url';
import { getBaseUrl } from '@site/src/helpers/base-url';
import RacingBars from '../RacingBars';
import type { Props } from '../../../../src';
import styles from './styles.module.css';
Expand Down Expand Up @@ -31,6 +31,7 @@ const PARAMS: Props = {
};

async function initPane(racer) {
const baseUrl = getBaseUrl();
const mod = await import(/* webpackIgnore: true */ `${baseUrl}/js/tweakpane.min.js`);
const { Pane } = mod;
const pane = new Pane({
Expand Down
3 changes: 2 additions & 1 deletion website/src/components/OpenInPlayground/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint-disable import/no-unresolved */
import React from 'react';
import { getPlaygroundUrl, type Config, type Language } from 'livecodes';
import { baseUrl } from '@site/src/helpers/base-url';
import { getBaseUrl } from '@site/src/helpers/base-url';
import styles from './styles.module.css';

export default function OpenInPlayground(props: { language: Language; code: string }) {
const baseUrl = getBaseUrl();
const config: Partial<Config> = {
title: 'RacingBars',
activeEditor: 'script',
Expand Down
5 changes: 2 additions & 3 deletions website/src/helpers/base-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';

export const baseUrl = ExecutionEnvironment.canUseDOM
? location.origin
: useDocusaurusContext().siteConfig.url;
export const getBaseUrl = () =>
ExecutionEnvironment.canUseDOM ? location.origin : useDocusaurusContext().siteConfig.url;
3 changes: 2 additions & 1 deletion website/src/pages/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import TabItem from '@theme/TabItem';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import type { Options } from '../../../src';
import { getFrameworkCode } from '../helpers/get-framework-code';
import { baseUrl } from '../helpers/base-url';
import { getBaseUrl } from '../helpers/base-url';
import { getCode } from '../components/OpenInPlayground';
import * as demos from '../../docs/gallery/_gallery-demos';

export default function Playground() {
const baseUrl = getBaseUrl();
const defaultOptions = demos.datasetPopulation;

const config: Partial<Config> = {
Expand Down

0 comments on commit 3d2fd00

Please sign in to comment.