Skip to content

An open source alternative to Tableau. Embeddable visual analytic

style: prettier code

ObservedObserver5160fb9d1a08
diff --git a/packages/graphic-walker/src/components/callout.tsx b/packages/graphic-walker/src/components/callout.tsx
index 2d81fbf3..a76ab066 100644
--- a/packages/graphic-walker/src/components/callout.tsx
+++ b/packages/graphic-walker/src/components/callout.tsx
@@ -1,8 +1,7 @@
-import React, { memo, ReactNode, useContext, useEffect, useState } from 'react';
-import { createPortal } from 'react-dom';
-import styled from 'styled-components';
-import { ShadowDomContext } from '..';
-
+import React, { memo, ReactNode, useContext, useEffect, useState } from "react";
+import { createPortal } from "react-dom";
+import styled from "styled-components";
+import { ShadowDomContext } from "..";
export interface CalloutProps {
target: string;
@@ -31,14 +30,14 @@ const Bubble = styled.div`
}
`;
-const Callout = memo<CalloutProps>(function Callout ({ target, children }) {
+const Callout = memo<CalloutProps>(function Callout({ target, children }) {
const shadowDomMeta = useContext(ShadowDomContext);
const { root } = shadowDomMeta;
const [pos, setPos] = useState<[number, number] | null>(null);
useEffect(() => {
const el = (
- target.startsWith('#') ? root?.getElementById(target.slice(1)) : root?.querySelector(target)
+ target.startsWith("#") ? root?.getElementById(target.slice(1)) : root?.querySelector(target)
) as HTMLElement | null;
if (el) {
const rect = el.getBoundingClientRect();
@@ -46,13 +45,16 @@ const Callout = memo<CalloutProps>(function Callout ({ target, children }) {
}
}, [target, root]);
- return root && pos && createPortal(
- <Bubble role="dialog" className="fixed bg-white z-50" style={{ left: pos[0], top: pos[1] + 4 }}>
- {children}
- </Bubble>,
- root
+ return (
+ root &&
+ pos &&
+ createPortal(
+ <Bubble role="dialog" className="fixed bg-white z-50" style={{ left: pos[0], top: pos[1] + 4 }}>
+ {children}
+ </Bubble>,
+ root
+ )
);
});
-
export default Callout;
diff --git a/packages/graphic-walker/src/components/clickMenu.tsx b/packages/graphic-walker/src/components/clickMenu.tsx
index 2204d353..7e8f6fb5 100644
--- a/packages/graphic-walker/src/components/clickMenu.tsx
+++ b/packages/graphic-walker/src/components/clickMenu.tsx
@@ -1,5 +1,5 @@
-import React from 'react';
-import styled from 'styled-components';
+import React from "react";
+import styled from "styled-components";
const MenuContainer = styled.div`
min-width: 100px;
@@ -17,13 +17,13 @@ interface ClickMenuProps {
y: number;
}
-const ClickMenu: React.FC<ClickMenuProps> = props => {
- const { x, y, children } = props
- return <MenuContainer className="shadow-lg text-sm" style={{ left: x + 'px', top: y + 'px' }}>
- {
- children
- }
- </MenuContainer>
-}
+const ClickMenu: React.FC<ClickMenuProps> = (props) => {
+ const { x, y, children } = props;
+ return (
+ <MenuContainer className="shadow-lg text-sm" style={{ left: x + "px", top: y + "px" }}>
+ {children}
+ </MenuContainer>
+ );
+};
export default ClickMenu;
diff --git a/packages/graphic-walker/src/components/container.tsx b/packages/graphic-walker/src/components/container.tsx
index 5f554eff..ac912b84 100644
--- a/packages/graphic-walker/src/components/container.tsx
+++ b/packages/graphic-walker/src/components/container.tsx
@@ -1,4 +1,4 @@
-import styled from 'styled-components';
+import styled from "styled-components";
export const Container = styled.div`
border: 1px solid #d9d9d9;
@@ -13,4 +13,4 @@ export const NestContainer = styled.div`
font-size: 12px;
margin: 0.2em;
background-color: #fff;
-`
\ No newline at end of file
+`;
diff --git a/packages/graphic-walker/src/components/dataTypeIcon.tsx b/packages/graphic-walker/src/components/dataTypeIcon.tsx
index a98aeb71..b4298bcc 100644
--- a/packages/graphic-walker/src/components/dataTypeIcon.tsx
+++ b/packages/graphic-walker/src/components/dataTypeIcon.tsx
@@ -1,20 +1,22 @@
-import React from 'react';
+import React from "react";
import { IMutField } from "../interfaces";
-import { DocumentTextIcon, HashtagIcon, CalendarIcon } from '@heroicons/react/24/outline';
+import { DocumentTextIcon, HashtagIcon, CalendarIcon } from "@heroicons/react/24/outline";
-const DataTypeIcon: React.FC<{dataType: IMutField['semanticType']; analyticType: IMutField['analyticType']}> = props => {
+const DataTypeIcon: React.FC<{ dataType: IMutField["semanticType"]; analyticType: IMutField["analyticType"] }> = (
+ props
+) => {
const { dataType, analyticType } = props;
- const color = analyticType === 'dimension' ? 'text-blue-500' : 'text-green-500'
- const iconClassName = `w-3 inline-block mr-0.5 ${color}`
+ const color = analyticType === "dimension" ? "text-blue-500" : "text-green-500";
+ const iconClassName = `w-3 inline-block mr-0.5 ${color}`;
switch (dataType) {
- case 'quantitative':
- case 'ordinal':
- return <HashtagIcon className={iconClassName} />
- case 'temporal':
- return <CalendarIcon className={iconClassName} />
+ case "quantitative":
+ case "ordinal":
+ return <HashtagIcon className={iconClassName} />;
+ case "temporal":
+ return <CalendarIcon className={iconClassName} />;
default:
- return <DocumentTextIcon className={iconClassName} />
+ return <DocumentTextIcon className={iconClassName} />;
}
-}
+};
-export default DataTypeIcon;
\ No newline at end of file
+export default DataTypeIcon;
diff --git a/packages/graphic-walker/src/components/liteForm.tsx b/packages/graphic-walker/src/components/liteForm.tsx
index bdc24592..89108074 100644
--- a/packages/graphic-walker/src/components/liteForm.tsx
+++ b/packages/graphic-walker/src/components/liteForm.tsx
@@ -1,16 +1,16 @@
-import styled from 'styled-components';
+import styled from "styled-components";
export const LiteForm = styled.div`
- display: flex;
- align-items: center;
- .item{
- margin: 5px 8px;
display: flex;
align-items: center;
- >label {
- margin-right: 4px;
- line-height: 20px;
- font-size: 12px;
+ .item {
+ margin: 5px 8px;
+ display: flex;
+ align-items: center;
+ > label {
+ margin-right: 4px;
+ line-height: 20px;
+ font-size: 12px;
+ }
}
- }
-`;
\ No newline at end of file
+`;
diff --git a/packages/graphic-walker/src/components/modal.tsx b/packages/graphic-walker/src/components/modal.tsx
index 7b380c1d..9fdc5d5d 100644
--- a/packages/graphic-walker/src/components/modal.tsx
+++ b/packages/graphic-walker/src/components/modal.tsx
@@ -1,90 +1,84 @@
-import React, { useRef } from 'react';
-import styled from 'styled-components';
-import { XCircleIcon } from '@heroicons/react/24/outline';
+import React, { useRef } from "react";
+import styled from "styled-components";
+import { XCircleIcon } from "@heroicons/react/24/outline";
const Background = styled.div({
- position: 'fixed',
- left: 0,
- top: 0,
- width: '100vw',
- height: '100vh',
- backdropFilter: 'blur(1px)',
- zIndex: 25535,
+ position: "fixed",
+ left: 0,
+ top: 0,
+ width: "100vw",
+ height: "100vh",
+ backdropFilter: "blur(1px)",
+ zIndex: 25535,
});
const Container = styled.div`
- width: 98%;
- @media (min-width: 600px) {
- width: 80%;
- }
- @media (min-width: 1100px) {
- width: 880px;
- }
- max-height: 800px;
- overflow: auto;
- > div.header {
- background-color: #f0f0f0;
- display: flex;
- padding: 12px;
- font-size: 14px;
- align-items: center;
- }
- > div.container {
- padding: 1em;
- }
- position: fixed;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- background-color: #fff;
- /* box-shadow: 0px 0px 12px 3px rgba(0, 0, 0, 0.19); */
- border-radius: 4px;
- z-index: 999;
+ width: 98%;
+ @media (min-width: 600px) {
+ width: 80%;
+ }
+ @media (min-width: 1100px) {
+ width: 880px;
+ }
+ max-height: 800px;
+ overflow: auto;
+ > div.header {
+ background-color: #f0f0f0;
+ display: flex;
+ padding: 12px;
+ font-size: 14px;
+ align-items: center;
+ }
+ > div.container {
+ padding: 1em;
+ }
+ position: fixed;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ background-color: #fff;
+ /* box-shadow: 0px 0px 12px 3px rgba(0, 0, 0, 0.19); */
+ border-radius: 4px;
+ z-index: 999;
`;
interface ModalProps {
- onClose?: () => void
- title?: string;
+ onClose?: () => void;
+ title?: string;
}
-const Modal: React.FC<ModalProps> = props => {
- const { onClose, title } = props;
- const prevMouseDownTimeRef = useRef(0);
+const Modal: React.FC<ModalProps> = (props) => {
+ const { onClose, title } = props;
+ const prevMouseDownTimeRef = useRef(0);
- return (
- <Background
- // This is a safer replacement of onClick handler.
- // onClick also happens if the click event is begun by pressing mouse button
- // at a different element and then released when the mouse is moved on the target element.
- // This case is required to be prevented, especially disturbing when interacting
- // with a Slider component.
- onMouseDown={() => prevMouseDownTimeRef.current = Date.now()}
- onMouseOut={() => prevMouseDownTimeRef.current = 0}
- onMouseUp={() => {
- if (Date.now() - prevMouseDownTimeRef.current < 1000) {
- onClose?.();
- }
- }}
- >
- <Container
- role="dialog"
- className="shadow-lg"
- onMouseDown={e => e.stopPropagation()}
- >
- <div className="header relative h-9">
- <header className="font-bold">
- {title}
- </header>
- <XCircleIcon
- className="text-red-600 absolute right-2 w-6 cursor-pointer"
- role="button"
- tabIndex={0}
- aria-label="close dialog"
- onClick={onClose}
- />
- </div>
- <div className="container">{props.children}</div>
- </Container>
- </Background>
- );
-}
+ return (
+ <Background
+ // This is a safer replacement of onClick handler.
+ // onClick also happens if the click event is begun by pressing mouse button
+ // at a different element and then released when the mouse is moved on the target element.
+ // This case is required to be prevented, especially disturbing when interacting
+ // with a Slider component.
+ onMouseDown={() => (prevMouseDownTimeRef.current = Date.now())}
+ onMouseOut={() => (prevMouseDownTimeRef.current = 0)}
+ onMouseUp={() => {
+ if (Date.now() - prevMouseDownTimeRef.current < 1000) {
+ onClose?.();
+ }
+ }}
+ >
+ <Container role="dialog" className="shadow-lg" onMouseDown={(e) => e.stopPropagation()}>
+ <div className="header relative h-9">
+ <header className="font-bold">{title}</header>
+ <XCircleIcon
+ className="text-red-600 absolute right-2 w-6 cursor-pointer"
+ role="button"
+ tabIndex={0}
+ aria-label="close dialog"
+ onClick={onClose}
+ />
+ </div>
+ <div className="container">{props.children}</div>
+ </Container>
+ </Background>
+ );
+};
export default Modal;
diff --git a/packages/graphic-walker/src/components/sizeSetting.tsx b/packages/graphic-walker/src/components/sizeSetting.tsx
index 6414cccf..0463d0f3 100644
--- a/packages/graphic-walker/src/components/sizeSetting.tsx
+++ b/packages/graphic-walker/src/components/sizeSetting.tsx
@@ -1,7 +1,6 @@
import { ArrowsPointingOutIcon, XMarkIcon } from "@heroicons/react/24/outline";
import React, { useState, useEffect } from "react";
-import { useTranslation } from 'react-i18next';
-
+import { useTranslation } from "react-i18next";
interface SizeSettingProps {
onWidthChange: (val: number) => void;
@@ -10,49 +9,57 @@ interface SizeSettingProps {
height: number;
}
-export const ResizeDialog: React.FC<SizeSettingProps> = props => {
- const { onWidthChange, onHeightChange, width, height, children } = props
- const { t } = useTranslation('translation', { keyPrefix: 'main.tabpanel.settings.size_setting' });
+export const ResizeDialog: React.FC<SizeSettingProps> = (props) => {
+ const { onWidthChange, onHeightChange, width, height, children } = props;
+ const { t } = useTranslation("translation", { keyPrefix: "main.tabpanel.settings.size_setting" });
- return <>
- {children}
- <div className="mt-4 w-60">
- <input className="w-full h-2 bg-blue-100 appearance-none"
- style={{ cursor: 'ew-resize' }}
- type="range"
- name="width"
- value={Math.sqrt(width / 1000)}
- min="0" max="1" step="0.01"
- onChange={(e) => {
- onWidthChange(Math.round(Number(e.target.value) ** 2 * 1000))
- }}
- />
- <output className="text-sm ml-1" htmlFor="width">
- {`${t('width')}: ${width}`}
- </output>
- </div>
- <div className=" mt-2">
- <input className="w-full h-2 bg-blue-100 appearance-none"
- style={{ cursor: 'ew-resize' }}
- type="range"
- name="height"
- value={Math.sqrt(height / 1000)}
- min="0" max="1" step="0.01"
- onChange={(e) => {
- onHeightChange(Math.round(Number(e.target.value) ** 2 * 1000))
- }}
- />
- <output className="text-sm ml-1" htmlFor="height">
- {`${t('height')}: ${height}`}
- </output>
- </div>
- </>
+ return (
+ <>
+ {children}
+ <div className="mt-4 w-60">
+ <input
+ className="w-full h-2 bg-blue-100 appearance-none"
+ style={{ cursor: "ew-resize" }}
+ type="range"
+ name="width"
+ value={Math.sqrt(width / 1000)}
+ min="0"
+ max="1"
+ step="0.01"
+ onChange={(e) => {
+ onWidthChange(Math.round(Number(e.target.value) ** 2 * 1000));
+ }}
+ />
+ <output className="text-sm ml-1" htmlFor="width">
+ {`${t("width")}: ${width}`}
+ </output>
+ </div>
+ <div className=" mt-2">
+ <input
+ className="w-full h-2 bg-blue-100 appearance-none"
+ style={{ cursor: "ew-resize" }}
+ type="range"
+ name="height"
+ value={Math.sqrt(height / 1000)}
+ min="0"
+ max="1"
+ step="0.01"
+ onChange={(e) => {
+ onHeightChange(Math.round(Number(e.target.value) ** 2 * 1000));
+ }}
+ />
+ <output className="text-sm ml-1" htmlFor="height">
+ {`${t("height")}: ${height}`}
+ </output>
+ </div>
+ </>
+ );
};
-const SizeSetting: React.FC<SizeSettingProps> = props => {
- const { onWidthChange, onHeightChange, width, height } = props
+const SizeSetting: React.FC<SizeSettingProps> = (props) => {
+ const { onWidthChange, onHeightChange, width, height } = props;
const [show, setShow] = useState<boolean>(false);
- const { t } = useTranslation('translation', { keyPrefix: 'main.tabpanel.settings.size_setting' });
+ const { t } = useTranslation("translation", { keyPrefix: "main.tabpanel.settings.size_setting" });
useEffect(() => {
if (show) {
@@ -63,45 +70,49 @@ const SizeSetting: React.FC<SizeSettingProps> = props => {
let subscribed = false;
const timer = setTimeout(() => {
subscribed = true;
- document.body.addEventListener('click', closeDialog);
+ document.body.addEventListener("click", closeDialog);
}, 200);
return () => {
clearTimeout(timer);
if (subscribed) {
- document.body.removeEventListener('click', closeDialog);
+ document.body.removeEventListener("click", closeDialog);
}
};
}
}, [show]);
- return <div className="leading-none cursor-pointer">
- <ArrowsPointingOutIcon
- role="button"
- id="button:size_setting"
- aria-describedby="button:size_setting:label"
- tabIndex={0}
- aria-haspopup="dialog"
- onClick={() => {
- setShow(v => !v)
- }}
- className="w-4 h-4 inline-block mr-0.5 text-gray-900"
- />
- {show && <ResizeDialog {...props}>
- <div>
- <XMarkIcon
- className="text-gray-900 absolute right-2 top-2 w-4 cursor-pointer hover:bg-red-100"
- role="button"
- tabIndex={0}
- aria-label="close"
- onClick={(e) => {
- setShow(false);
- e.stopPropagation();
- }}
- />
- </div>
- </ResizeDialog>}
- </div>
-}
+ return (
+ <div className="leading-none cursor-pointer">
+ <ArrowsPointingOutIcon
+ role="button"
+ id="button:size_setting"
+ aria-describedby="button:size_setting:label"
+ tabIndex={0}
+ aria-haspopup="dialog"
+ onClick={() => {
+ setShow((v) => !v);
+ }}
+ className="w-4 h-4 inline-block mr-0.5 text-gray-900"
+ />
+ {show && (
+ <ResizeDialog {...props}>
+ <div>
+ <XMarkIcon
+ className="text-gray-900 absolute right-2 top-2 w-4 cursor-pointer hover:bg-red-100"
+ role="button"
+ tabIndex={0}
+ aria-label="close"
+ onClick={(e) => {
+ setShow(false);
+ e.stopPropagation();
+ }}
+ />
+ </div>
+ </ResizeDialog>
+ )}
+ </div>
+ );
+};
-export default SizeSetting;
\ No newline at end of file
+export default SizeSetting;
diff --git a/packages/graphic-walker/src/components/tooltip.tsx b/packages/graphic-walker/src/components/tooltip.tsx
index b1f9c834..0acedbe3 100644
--- a/packages/graphic-walker/src/components/tooltip.tsx
+++ b/packages/graphic-walker/src/components/tooltip.tsx
@@ -3,7 +3,6 @@ import { createPortal } from "react-dom";
import styled from "styled-components";
import { ShadowDomContext } from "..";
-
export interface TooltipProps {
children: JSX.Element;
content: string | JSX.Element | JSX.Element[];
@@ -15,7 +14,7 @@ export interface TooltipProps {
autoHide?: number;
}
-const attrName = 'data-tooltip-host-id';
+const attrName = "data-tooltip-host-id";
let flag = 0;
const Bubble = styled.div`
@@ -37,15 +36,21 @@ const Bubble = styled.div`
}
`;
-const Tooltip = memo<TooltipProps>(function Tooltip ({ children, content, autoHide = 3_000, showDelay = 250, hideDelay = 250 }) {
+const Tooltip = memo<TooltipProps>(function Tooltip({
+ children,
+ content,
+ autoHide = 3_000,
+ showDelay = 250,
+ hideDelay = 250,
+}) {
const hostId = useMemo(() => flag++, []);
const [pos, setPos] = useState<[number, number]>([0, 0]);
const [show, setShow] = useState(false);
const [hover, setHover] = useState(false);
const shadowDomMeta = useContext(ShadowDomContext);
const { root } = shadowDomMeta;
- const element = typeof children === 'object' ? { ...children as any } : children;
- if ('props' in element) {
+ const element = typeof children === "object" ? { ...(children as any) } : children;
+ if ("props" in element) {
element.props = {
...element.props,
[attrName]: hostId,
@@ -99,13 +104,13 @@ const Tooltip = memo<TooltipProps>(function Tooltip ({ children, content, autoHi
setShow(false);
}, hideDelayRef.current);
};
- item.addEventListener('mouseover', handleMouseOver);
- item.addEventListener('mousemove', handleMouseMove);
- item.addEventListener('mouseout', handleMouseOut);
+ item.addEventListener("mouseover", handleMouseOver);
+ item.addEventListener("mousemove", handleMouseMove);
+ item.addEventListener("mouseout", handleMouseOut);
return () => {
- item.removeEventListener('mouseover', handleMouseOver);
- item.removeEventListener('mousemove', handleMouseMove);
- item.removeEventListener('mouseout', handleMouseOut);
+ item.removeEventListener("mouseover", handleMouseOver);
+ item.removeEventListener("mousemove", handleMouseMove);
+ item.removeEventListener("mouseout", handleMouseOut);
if (autoHideTimer) {
clearTimeout(autoHideTimer);
}
@@ -116,20 +121,21 @@ const Tooltip = memo<TooltipProps>(function Tooltip ({ children, content, autoHi
return (
<>
{element}
- {(show || hover) && root && createPortal(
- <Bubble
- className="fixed text-xs p-1 px-3 text-gray-500 bg-white z-50"
- onMouseOver={() => setHover(true)}
- onMouseOut={() => setHover(false)}
- style={{ left: pos[0], top: pos[1] - 4 }}
- >
- {content}
- </Bubble>,
- root
- )}
+ {(show || hover) &&
+ root &&
+ createPortal(
+ <Bubble
+ className="fixed text-xs p-1 px-3 text-gray-500 bg-white z-50"
+ onMouseOver={() => setHover(true)}
+ onMouseOut={() => setHover(false)}
+ style={{ left: pos[0], top: pos[1] - 4 }}
+ >
+ {content}
+ </Bubble>,
+ root
+ )}
</>
);
});
-
export default Tooltip;
diff --git a/packages/graphic-walker/src/dataSource/dataSelection/csvData.tsx b/packages/graphic-walker/src/dataSource/dataSelection/csvData.tsx
index 340f1f4e..0febfb3f 100644
--- a/packages/graphic-walker/src/dataSource/dataSelection/csvData.tsx
+++ b/packages/graphic-walker/src/dataSource/dataSelection/csvData.tsx
@@ -1,19 +1,18 @@
-import React, { useRef, useCallback } from 'react';
-import { FileReader } from '@kanaries/web-data-loader';
-import { IRow } from '../../interfaces';
-import Table from '../table';
-import styled from 'styled-components';
-import { useGlobalStore } from '../../store';
-import { observer } from 'mobx-react-lite';
-import { useTranslation } from 'react-i18next';
+import React, { useRef, useCallback } from "react";
+import { FileReader } from "@kanaries/web-data-loader";
+import { IRow } from "../../interfaces";
+import Table from "../table";
+import styled from "styled-components";
+import { useGlobalStore } from "../../store";
+import { observer } from "mobx-react-lite";
+import { useTranslation } from "react-i18next";
const Container = styled.div`
overflow-x: auto;
`;
-interface ICSVData {
-}
-const CSVData: React.FC<ICSVData> = props => {
+interface ICSVData {}
+const CSVData: React.FC<ICSVData> = (props) => {
const fileRef = useRef<HTMLInputElement>(null);
const { commonStore } = useGlobalStore();
const { tmpDSName, tmpDataSource } = commonStore;
@@ -22,12 +21,12 @@ const CSVData: React.FC<ICSVData> = props => {
commonStore.commitTempDS();
}, []);
- const { t } = useTranslation('translation', { keyPrefix: 'DataSource.dialog.file' });
+ const { t } = useTranslation("translation", { keyPrefix: "DataSource.dialog.file" });
return (
<Container>
<input
- style={{ display: 'none' }}
+ style={{ display: "none" }}
type="file"
ref={fileRef}
onChange={(e) => {
@@ -36,8 +35,8 @@ const CSVData: React.FC<ICSVData> = props => {
const file = files[0];
FileReader.csvReader({
file,
- config: { type: 'reservoirSampling', size: Infinity },
- onLoading: () => {}
+ config: { type: "reservoirSampling", size: Infinity },
+ onLoading: () => {},
}).then((data) => {
commonStore.updateTempDS(data as IRow[]);
});
@@ -45,26 +44,34 @@ const CSVData: React.FC<ICSVData> = props => {
}}
/>
<div className="mt-1 mb-1">
- <button className="inline-block min-w-96 text-xs mr-2 pt-1 pb-1 pl-6 pr-6 border border-gray-500 rounded-sm cursor-pointer hover:bg-gray-200"
- onClick={() => { if (fileRef.current) { fileRef.current.click(); }}}
+ <button
+ className="inline-block min-w-96 text-xs mr-2 pt-1 pb-1 pl-6 pr-6 border border-gray-500 rounded-sm cursor-pointer hover:bg-gray-200"
+ onClick={() => {
+ if (fileRef.current) {
+ fileRef.current.click();
+ }
+ }}
>
- {t('open')}
+ {t("open")}
</button>
- <button className="inline-block min-w-96 text-xs mr-2 pt-1 pb-1 pl-6 pr-6 bg-yellow-600 rounded-sm hover:bg-yellow-500 text-white font-bold disabled:bg-gray-300"
+ <button
+ className="inline-block min-w-96 text-xs mr-2 pt-1 pb-1 pl-6 pr-6 bg-yellow-600 rounded-sm hover:bg-yellow-500 text-white font-bold disabled:bg-gray-300"
disabled={tmpDataSource.length === 0}
- onClick={() => { onSubmitData(); }}
+ onClick={() => {
+ onSubmitData();
+ }}
>
- {t('submit')}
+ {t("submit")}
</button>
</div>
<div className="mt-1 mb-1">
- <label className="block text-xs text-gray-800">
- {t('dataset_name')}
- </label>
- <input type="text" placeholder={t('dataset_name')}
+ <label className="block text-xs text-gray-800">{t("dataset_name")}</label>
+ <input
+ type="text"
+ placeholder={t("dataset_name")}
value={tmpDSName}
- onChange={e => {
- commonStore.updateTempName(e.target.value)
+ onChange={(e) => {
+ commonStore.updateTempName(e.target.value);
}}
className="text-xs p-1 border border-gray-300 outline-none focus:outline-none focus:border-blue-500"
/>
@@ -72,6 +79,6 @@ const CSVData: React.FC<ICSVData> = props => {
<Table />
</Container>
);
-}
+};
export default observer(CSVData);
diff --git a/packages/graphic-walker/src/dataSource/dataSelection/index.tsx b/packages/graphic-walker/src/dataSource/dataSelection/index.tsx
index 854d967a..f7fb486e 100644
--- a/packages/graphic-walker/src/dataSource/dataSelection/index.tsx
+++ b/packages/graphic-walker/src/dataSource/dataSelection/index.tsx
@@ -4,10 +4,6 @@ import CSVData from './csvData';
import PublicData from './publicData';
import { useTranslation } from 'react-i18next';
-interface IDataSelectionProps {
-
-}
-
const DataSelection: React.FC = props =>{
const [sourceType, setSourceType] = useState<'file' | 'public'>('file');
const { t } = useTranslation('translation', { keyPrefix: 'DataSource' });