Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Styled/Box.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Ref } from "react";
import styled from "styled-components";
import { OneKeyFrom, Overflow, WhiteSpace, WordBreak } from "./Styled.types";
import { Overflow, WhiteSpace, WordBreak } from "./Styled.types";

interface Column {
col1?: boolean;
Expand Down Expand Up @@ -68,7 +68,7 @@ export interface IBoxPropsBase {
as?: React.ElementType | keyof JSX.IntrinsicElements;
}

export type IBoxProps = IBoxPropsBase & OneKeyFrom<Column>;
export type IBoxProps = IBoxPropsBase & Column;

export const Box = styled.div<IBoxProps>`
display: flex;
Expand Down
6 changes: 0 additions & 6 deletions lib/Styled/Styled.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ export type WhiteSpace =
| "initial"
| "inherit";

export type OneKeyFrom<T, K extends keyof T = keyof T> = K extends any
? Pick<T, K> & Partial<Record<Exclude<keyof T, K>, never>> extends infer O
? { [P in keyof O]: O[P] }
: never
: never;

/**
* Types that can be used after upgrade to ts4.
*/
Expand Down
7 changes: 3 additions & 4 deletions lib/Styled/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ComponentProps } from "react";
import styled from "styled-components";
import { OneKeyFrom } from "./Styled.types";

interface ITextSize {
noFontSize?: boolean;
Expand Down Expand Up @@ -52,9 +51,9 @@ export interface ITextPropsBase {
}

export type ITextProps = ITextPropsBase &
OneKeyFrom<ITextSize> &
OneKeyFrom<ITextColor> &
OneKeyFrom<ITextWeight> &
ITextSize &
ITextColor &
ITextWeight &
ComponentProps<"div">;

// should it be a span or inline-block-div? - leaning to div
Expand Down