Skip to content

Commit

Permalink
formating
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Marc Millet authored and Jean-Marc Millet committed Oct 20, 2023
1 parent f46b123 commit 82019b4
Show file tree
Hide file tree
Showing 48 changed files with 1,770 additions and 1,658 deletions.
9 changes: 4 additions & 5 deletions src/lib/components/form/Form.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ const ScrollArea = styled(BasicPageLayout)`
overflow-y: auto;
`;

const LabelContext =
createContext<{
maxLabelWidth: number;
setMaxLabelWidth: (setter: (value: number) => number) => void;
} | null>(null);
const LabelContext = createContext<{
maxLabelWidth: number;
setMaxLabelWidth: (setter: (value: number) => number) => void;
} | null>(null);

const RequireModeContext = createContext<'all' | 'partial'>('partial');

Expand Down
11 changes: 5 additions & 6 deletions src/lib/components/selectv2/Selectv2.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,11 @@ type SelectOptionProps = {
optionProps: any;
};

const OptionContext =
createContext<{
options: Record<string, SelectOptionProps>;
register: (option: SelectOptionProps) => void;
unregister: (value: string) => void;
} | null>(null);
const OptionContext = createContext<{
options: Record<string, SelectOptionProps>;
register: (option: SelectOptionProps) => void;
unregister: (value: string) => void;
} | null>(null);

function SelectWithOptionContext(props: SelectProps) {
const [options, setOptions] = useState<Record<string, SelectOptionProps>>({});
Expand Down
6 changes: 4 additions & 2 deletions src/lib/components/tablev2/Tablev2.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ type UpdateTableData<
) => void;
};
export type Column<D extends Record<string, unknown>> = CoreUIColumn<D>;
export type CellProps<D extends Record<string, unknown>, V = unknown> =
TableCellProps<D, V> & UpdateTableData<D>;
export type CellProps<
D extends Record<string, unknown>,
V = unknown,
> = TableCellProps<D, V> & UpdateTableData<D>;

export type TableProps<
DATA_ROW extends Record<string, unknown> = Record<string, unknown>,
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/tabsv2/Tabsv2.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ function Tabs({
const location = useLocation();
const history = useHistory();
const { url } = useRouteMatch();
const [selectedTabIndex, setSelectedTabIndex] =
useState<number | null | undefined>(null);
const [selectedTabIndex, setSelectedTabIndex] = useState<
number | null | undefined
>(null);
const queryURL = new URLSearchParams(location.search);
const filteredTabsChildren = React.Children.toArray(children).filter(
(child) => React.isValidElement(child) && child.type === Tab,
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/toast/ToastProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ export interface ToastContextType {
showToast: (toastProps: ToastContextState) => void;
}

export const ToastContext =
createContext<ToastContextType | undefined>(undefined);
export const ToastContext = createContext<ToastContextType | undefined>(
undefined,
);

interface ToastProviderProps {
children: ReactNode;
Expand Down
34 changes: 16 additions & 18 deletions src/lib/organisms/attachments/AttachmentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,22 @@ const CenterredSecondaryText = styled(SecondaryText)`
text-align: center;
`;

const PrivateAttachmentContext =
createContext<{
setResetAttachementTable: Dispatch<
SetStateAction<
(
initiallyAttachedEntities: AttachableEntity<any>[], //Deliberately using any here because we can't use generics
initialAttachmentOperations: AttachmentOperation<any>[],
) => void
>
>;
} | null>(null);
const AttachmentContext =
createContext<{
resetAttachmentTable: (
initiallyAttachedEntities: AttachableEntity<any>[], //Deliberately using any here because we can't use generics
initialAttachmentOperations: AttachmentOperation<any>[],
) => void;
} | null>(null);
const PrivateAttachmentContext = createContext<{
setResetAttachementTable: Dispatch<
SetStateAction<
(
initiallyAttachedEntities: AttachableEntity<any>[], //Deliberately using any here because we can't use generics
initialAttachmentOperations: AttachmentOperation<any>[],
) => void
>
>;
} | null>(null);
const AttachmentContext = createContext<{
resetAttachmentTable: (
initiallyAttachedEntities: AttachableEntity<any>[], //Deliberately using any here because we can't use generics
initialAttachmentOperations: AttachmentOperation<any>[],
) => void;
} | null>(null);

export const AttachmentProvider = <ENTITY_TYPE extends unknown>({
children,
Expand Down
4 changes: 2 additions & 2 deletions stories/areachart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const Default = {
export const Default = {
render: ({}) => {
return (
<Wrapper style={{padding:'5rem'}}>
<Wrapper style={{ padding: '5rem' }}>
<Title>Vege-Lite area chart</Title>
<AreaChart
id={id_area_chart}
Expand All @@ -138,4 +138,4 @@ export const Default = {
</Wrapper>
);
},
};
};
58 changes: 29 additions & 29 deletions stories/banner.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { Wrapper } from './common';
export default {
title: 'Components/Notification/Banner',
component: Banner,
decorators: [(story) => <Wrapper >{story()}</Wrapper>],
args:{
icon: <Icon name='Exclamation-triangle'/>
decorators: [(story) => <Wrapper>{story()}</Wrapper>],
args: {
icon: <Icon name="Exclamation-triangle" />,
},
argTypes: {
children: {
Expand All @@ -19,10 +19,10 @@ export default {
variant: {
control: {
type: 'select',
disable:true
disable: true,
},
},
title: {control: { disable:true}},
title: { control: { disable: true } },
icon: {
control: {
disable: true,
Expand All @@ -32,44 +32,44 @@ export default {
};

export const Playground = {
args:{
args: {
variant: 'success',
children:"Some text explaining what happened",
children: 'Some text explaining what happened',
},
argTypes: {
variant: { control: { disable: false } },
title: { control: { disable: false } },
children: { control: { disable: false } },
icon: { control: { disable: false } },
},
argTypes:{
variant:{control: {disable:false}},
title:{control: {disable:false}},
children:{control: {disable:false}},
icon:{control:{disable:false}},
}
};

export const Default = {
args:{
args: {
children: 'There is an alert',
variant:"success",
}
}
variant: 'info',
},
};

export const SuccessBanner = {
args:{
variant:"success",
title:'Success',
children:"There is a success",
args: {
variant: 'success',
title: 'Success',
children: 'There is a success',
},
};

export const WarningBanner = {
args:{
variant:"warning",
title:'Warning',
children:"There is a warning",
args: {
variant: 'warning',
title: 'Warning',
children: 'There is a warning',
},
};
export const ErrorBanner = {
args:{
variant:"danger",
title:'Error',
children:"There is an error",
args: {
variant: 'danger',
title: 'Error',
children: 'There is an error',
},
};
88 changes: 43 additions & 45 deletions stories/barchart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ const barConfig = {
// props for vertical stacked bar chart
const idVerticalStacked = 'vis_vertical_stacked';



// props for vertical stacked bar chart

const verticalStackedBarChartArgs = {
id:'vis_vertical_stacked',
xAxis:{
id: 'vis_vertical_stacked',
xAxis: {
field: 'xlabel',
type: 'ordinal',
title: null,
Expand All @@ -47,7 +45,7 @@ const verticalStackedBarChartArgs = {
padding: 1,
},
},
color:{
color: {
field: 'status',
type: 'nominal',
legend: {
Expand All @@ -62,83 +60,83 @@ const verticalStackedBarChartArgs = {
range: ['#4BE4E2', '#E45834', '#FEFA52', '#968BFF', '#BE2543', '#DC90F1'],
},
},
data:verticalStackedData,
barConfig
}
data: verticalStackedData,
barConfig,
};

// props for horizontal stacked bar chart
const horizontalStackedChartArgs = {
id:'vis_horizontal_stacked',
xAxis:{
aggregate: 'sum',
field: 'yield',
type: 'quantitative',
id: 'vis_horizontal_stacked',
xAxis: {
aggregate: 'sum',
field: 'yield',
type: 'quantitative',
},
yAxis: {
field: 'variety',
type: 'nominal',
field: 'variety',
type: 'nominal',
},
color:{
field: 'site',
type: 'nominal',
color: {
field: 'site',
type: 'nominal',
},
data:horizontalStackedData
}
data: horizontalStackedData,
};

// props for vertical bar chart props
const verticalBarChartArgs = {
id: 'vis_vertical',
xAxis:{
xAxis: {
field: 'a',
type: 'ordinal',
},
yAxis:{
yAxis: {
field: 'b',
type: 'quantitative',
},
data:barchartData

}
data: barchartData,
};

//props for horizontal bar chart
const horizontalBarChartArgs = {
id: 'vis_horizontal',
xAxis:{
xAxis: {
field: 'b',
type: 'quantitative',
},
yAxis:{
yAxis: {
field: 'a',
type: 'ordinal',
},
data:barchartData
}

data: barchartData,
};

export default {
title: 'Components/Chart/BarChart',
component: BarChart,
decorators:[(story:Component) => (
<Wrapper style={{minHeight:'30vh', padding:'3rem',backgroundColor:'white'}}>
<SyncedCursorCharts>
{story()}
</SyncedCursorCharts>
</Wrapper>) ],
decorators: [
(story: Component) => (
<Wrapper
style={{ minHeight: '30vh', padding: '3rem', backgroundColor: 'white' }}
>
<SyncedCursorCharts>{story()}</SyncedCursorCharts>
</Wrapper>
),
],
};

export const verticalStackedChart = {
args:{...verticalStackedBarChartArgs}
}
args: { ...verticalStackedBarChartArgs },
};

export const horizontalStackedchart = {
args:{...horizontalStackedChartArgs}
}
args: { ...horizontalStackedChartArgs },
};

export const verticalBarChart = {
args:{...verticalBarChartArgs}
}
args: { ...verticalBarChartArgs },
};

export const horizontalBarChart = {
args: {...horizontalBarChartArgs}
}

args: { ...horizontalBarChartArgs },
};
6 changes: 1 addition & 5 deletions stories/box.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Box } from '../src/lib/components/box/Box';
const info = {
title: 'Components/Box',
component: Box,
decorators: [story => <HighlightBorder>{story()}</HighlightBorder>]
decorators: [(story) => <HighlightBorder>{story()}</HighlightBorder>],
};

export default info;
Expand Down Expand Up @@ -39,8 +39,6 @@ export const margin = {
<Box m={13}>Props m 13 = 2.857rem</Box>
<Box m={14}>Props m 14 = 14px</Box>
</>


);
},
};
Expand All @@ -56,8 +54,6 @@ export const font = {
<Box fontSize="huge">huge font</Box>
<Box fontSize="massive">massive font</Box>
</>


);
},
};
Expand Down
Loading

0 comments on commit 82019b4

Please sign in to comment.