mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Simplify "Showable"
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
2a2ab66a44
commit
7048683c14
@ -14,7 +14,11 @@ export interface Showable<
|
|||||||
isShown?: T;
|
isShown?: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isShown = (showable: Showable) => {
|
export const isShown = (showable: Showable | {}) => {
|
||||||
|
if (!("isShown" in showable)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (showable.isShown === undefined) {
|
if (showable.isShown === undefined) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,20 +6,17 @@ import React from "react";
|
|||||||
import { HorizontalLine } from "../../../../renderer/components/horizontal-line/horizontal-line";
|
import { HorizontalLine } from "../../../../renderer/components/horizontal-line/horizontal-line";
|
||||||
import type { RootComposite } from "../../../../common/utils/composite/interfaces";
|
import type { RootComposite } from "../../../../common/utils/composite/interfaces";
|
||||||
import type { Discriminable } from "../../../../common/utils/composable-responsibilities/discriminable/discriminable";
|
import type { Discriminable } from "../../../../common/utils/composable-responsibilities/discriminable/discriminable";
|
||||||
import type { Showable } from "../../../../common/utils/composable-responsibilities/showable/showable";
|
|
||||||
import type { ChildrenAreSeparated } from "./preference-item-injection-token";
|
import type { ChildrenAreSeparated } from "./preference-item-injection-token";
|
||||||
|
|
||||||
export type PreferenceTabsRoot =
|
export type PreferenceTabsRoot =
|
||||||
& Discriminable<"preference-tabs-root">
|
& Discriminable<"preference-tabs-root">
|
||||||
& RootComposite
|
& RootComposite
|
||||||
& ChildrenAreSeparated
|
& ChildrenAreSeparated;
|
||||||
& Showable<true>;
|
|
||||||
|
|
||||||
export const preferenceTabsRoot: PreferenceTabsRoot = {
|
export const preferenceTabsRoot: PreferenceTabsRoot = {
|
||||||
kind: "preference-tabs-root" as const,
|
kind: "preference-tabs-root" as const,
|
||||||
id: "preference-tabs",
|
id: "preference-tabs",
|
||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
isShown: true as const,
|
|
||||||
|
|
||||||
childSeparator: () => (
|
childSeparator: () => (
|
||||||
<div style={{ padding: "0 10px" }}>
|
<div style={{ padding: "0 10px" }}>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user