Skip to content

Commit

Permalink
Refactor component types and import statements in multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed Apr 21, 2024
1 parent 0f92e37 commit 308fe26
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
4 changes: 3 additions & 1 deletion CommonUI/src/Components/Detail/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export interface ComponentProps<T extends GenericObject> {
showDetailsInNumberOfColumns?: number | undefined;
}

const Detail = <T extends GenericObject>(
type DetailFunction = <T extends Object>(props: ComponentProps<T>) => ReactElement;

const Detail: DetailFunction = <T extends GenericObject>(
props: ComponentProps<T>
): ReactElement => {
type GetMarkdownViewerFunction = (text: string) => ReactElement;
Expand Down
4 changes: 3 additions & 1 deletion CommonUI/src/Components/List/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export interface ComponentProps<T extends GenericObject> {
onFilterRefreshClick?: undefined | (() => void);
}

const List = <T extends GenericObject>(
type ListFunction = <T extends Object>(props: ComponentProps<T>) => ReactElement;

const List: ListFunction = <T extends GenericObject>(
props: ComponentProps<T>
): ReactElement => {
const getListbody: GetReactElementFunction = (): ReactElement => {
Expand Down
4 changes: 3 additions & 1 deletion CommonUI/src/Components/List/ListBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export interface ComponentProps<T extends GenericObject> {
listDetailOptions?: undefined | ListDetailProps;
}

const ListBody = <T extends GenericObject>(
type ListBodyFunction = <T extends Object>(props: ComponentProps<T>) => ReactElement;

const ListBody: ListBodyFunction = <T extends GenericObject>(
props: ComponentProps<T>
): ReactElement => {
type GetBodyFunction = (provided?: DroppableProvided) => ReactElement;
Expand Down
4 changes: 3 additions & 1 deletion CommonUI/src/Components/OrderedStatesList/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export interface ComponentProps<T extends GenericObject> {
getDescriptionElement?: ((item: T) => ReactElement) | undefined;
}

const Item = <T extends GenericObject>(
type ItemFunction = <T extends Object>(props: ComponentProps<T>) => ReactElement;

const Item: ItemFunction = <T extends GenericObject>(
props: ComponentProps<T>
): ReactElement => {
const [isButtonLoading, setIsButtonLoading] = useState<Array<boolean>>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export interface ComponentProps<T extends GenericObject> {
shouldAddItemInTheBeginning?: boolean | undefined;
}

const OrderedStatesList = <T extends GenericObject>(
type OrderedStatesListFunction = <T extends Object>(
props: ComponentProps<T>
) => ReactElement;

const OrderedStatesList: OrderedStatesListFunction = <T extends GenericObject>(
props: ComponentProps<T>
): ReactElement => {
if (props.isLoading) {
Expand Down
2 changes: 1 addition & 1 deletion CommonUI/src/Components/Table/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface ComponentProps<T extends GenericObject> {
dragDropIndexField?: keyof T | undefined;
}

type TableRowFunction = <T extends Object>(
type TableRowFunction = <T extends GenericObject>(
props: ComponentProps<T>
) => ReactElement;

Expand Down
6 changes: 3 additions & 3 deletions Dashboard/src/Utils/SpanUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class SpanUtil {
public static getSpanDurationAsString(data: {
divisibilityFactor: DivisibilityFactor;
spanDurationInUnixNano: number;
}) {
}): string {
const { divisibilityFactor, spanDurationInUnixNano } = data;

return `${Math.round(
Expand All @@ -31,7 +31,7 @@ export default class SpanUtil {
divisibilityFactor: DivisibilityFactor;
timelineStartTimeUnixNano: number;
spanStartTimeUnixNano: number;
}) {
}): string {
const {
divisibilityFactor,
timelineStartTimeUnixNano,
Expand All @@ -48,7 +48,7 @@ export default class SpanUtil {
divisibilityFactor: DivisibilityFactor;
timelineStartTimeUnixNano: number;
spanEndTimeUnixNano: number;
}) {
}): string {
const {
divisibilityFactor,
timelineStartTimeUnixNano,
Expand Down

0 comments on commit 308fe26

Please sign in to comment.