just some more api report cleanup

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-04-01 14:59:50 +02:00
parent 947ce9d60d
commit 99063c39ae
40 changed files with 187 additions and 287 deletions
@@ -38,15 +38,7 @@ const useStyles = makeStyles((theme: Theme) => ({
},
}));
export const ComponentAccordion = ({
title,
expanded = false,
Content,
Actions,
Settings,
ContextProvider,
...childProps
}: {
export const ComponentAccordion = (props: {
title: string;
expanded?: boolean;
Content: () => JSX.Element;
@@ -54,6 +46,16 @@ export const ComponentAccordion = ({
Settings?: () => JSX.Element;
ContextProvider?: (props: any) => JSX.Element;
}) => {
const {
title,
expanded = false,
Content,
Actions,
Settings,
ContextProvider,
...childProps
} = props;
const classes = useStyles();
const [settingsIsExpanded, setSettingsIsExpanded] = React.useState(false);
const [isExpanded, setIsExpanded] = React.useState(expanded);
@@ -16,16 +16,13 @@
import React from 'react';
export const ComponentTab = ({
title,
Content,
ContextProvider,
...childProps
}: {
export const ComponentTab = (props: {
title: string;
Content: () => JSX.Element;
ContextProvider?: (props: any) => JSX.Element;
}) => {
const { title, Content, ContextProvider, ...childProps } = props;
return ContextProvider ? (
<ContextProvider {...childProps}>
<Content />
@@ -23,13 +23,9 @@ type TabType = {
Component: () => JSX.Element;
};
export const ComponentTabs = ({
title,
tabs,
}: {
title: string;
tabs: TabType[];
}) => {
export const ComponentTabs = (props: { title: string; tabs: TabType[] }) => {
const { title, tabs } = props;
const [value, setValue] = React.useState(0);
const handleChange = (_event: any, newValue: number) => {
@@ -68,11 +68,10 @@ function getTimes(clockConfigs: ClockConfig[]) {
return clocks;
}
export const HeaderWorldClock = ({
clockConfigs,
}: {
clockConfigs: ClockConfig[];
}) => {
/** @public */
export const HeaderWorldClock = (props: { clockConfigs: ClockConfig[] }) => {
const { clockConfigs } = props;
const defaultTimes: TimeObj[] = [];
const [clocks, setTimes] = React.useState(defaultTimes);
@@ -23,17 +23,14 @@ import {
DialogTitle,
} from '@material-ui/core';
export const SettingsModal = ({
open,
close,
componentName,
children,
}: {
export const SettingsModal = (props: {
open: boolean;
close: Function;
componentName: string;
children: JSX.Element;
}) => {
const { open, close, componentName, children } = props;
return (
<Dialog open={open} onClose={() => close()}>
<DialogTitle>Settings - {componentName}</DialogTitle>
+3 -5
View File
@@ -44,15 +44,13 @@ type CardExtensionProps<T> = ComponentRenderer & { title?: string } & T;
*
* @public
*/
export function createCardExtension<T>({
title,
components,
name,
}: {
export function createCardExtension<T>(options: {
title: string;
components: () => Promise<ComponentParts>;
name?: string;
}) {
const { title, components, name } = options;
return createReactExtension({
name,
component: {
@@ -42,13 +42,12 @@ const getNewJoke = (type: string): Promise<Joke> =>
.then(res => res.json())
.then(data => (Array.isArray(data) ? data[0] : data));
export const ContextProvider = ({
children,
defaultCategory,
}: {
export const ContextProvider = (props: {
children: JSX.Element;
defaultCategory?: JokeType;
}) => {
const { children, defaultCategory } = props;
const [loading, setLoading] = React.useState(true);
const [joke, setJoke] = React.useState<Joke>({
setup: '',
@@ -28,13 +28,12 @@ type ToolkitContextValue = {
const Context = createContext<ToolkitContextValue | undefined>(undefined);
export const ContextProvider = ({
children,
tools,
}: {
export const ContextProvider = (props: {
children: JSX.Element;
tools: Tool[];
}) => {
const { children, tools } = props;
const [toolsValue, _setTools] = React.useState(tools);
const value: ToolkitContextValue = {
+8
View File
@@ -23,6 +23,7 @@ import { ToolkitContentProps } from './homePageComponents';
import { rootRouteRef } from './routes';
/** @public */
export const homePlugin = createPlugin({
id: 'home',
routes: {
@@ -30,6 +31,7 @@ export const homePlugin = createPlugin({
},
});
/** @public */
export const HomepageCompositionRoot = homePlugin.provide(
createRoutableExtension({
name: 'HomepageCompositionRoot',
@@ -39,6 +41,7 @@ export const HomepageCompositionRoot = homePlugin.provide(
}),
);
/** @public */
export const ComponentAccordion = homePlugin.provide(
createComponentExtension({
name: 'ComponentAccordion',
@@ -48,6 +51,8 @@ export const ComponentAccordion = homePlugin.provide(
},
}),
);
/** @public */
export const ComponentTabs = homePlugin.provide(
createComponentExtension({
name: 'ComponentTabs',
@@ -56,6 +61,8 @@ export const ComponentTabs = homePlugin.provide(
},
}),
);
/** @public */
export const ComponentTab = homePlugin.provide(
createComponentExtension({
name: 'ComponentTab',
@@ -95,6 +102,7 @@ export const HomePageCompanyLogo = homePlugin.provide(
}),
);
/** @public */
export const HomePageRandomJoke = homePlugin.provide(
createCardExtension<{ defaultCategory?: 'any' | 'programming' }>({
name: 'HomePageRandomJoke',
File diff suppressed because one or more lines are too long