Skip to content

Commit

Permalink
minor type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anilanar committed Aug 25, 2024
1 parent cd10a9b commit c8c767e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/chakra-ui/src/Scrollable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { useTheme } from "@chakra-ui/react";
import { chakra, forwardRef } from "@chakra-ui/system";
import {
__DEV__,
AlignItems,
FlexDirection,
isHorizontal,
isVertical,
JustifyContent,
MoblinTheme,
unsafeCoerce,
} from "@moblin/core";
Expand All @@ -14,7 +14,7 @@ import { ContainerProps } from "./props";

export interface ScrollableOptions {
direction?: FlexDirection;
justifyContent?: AlignItems;
justifyContent?: JustifyContent;
overflowAnchor?: "auto" | "none";
}

Expand Down Expand Up @@ -75,10 +75,10 @@ const marginEndProp = (direction: FlexDirection) => {
return isHorizontal(direction) ? "marginInlineEnd" : "marginBlockEnd";
};

const marginStart = (justifyContent: AlignItems) =>
const marginStart = (justifyContent: JustifyContent) =>
justifyContent === "stretch" || justifyContent === "flex-start"
? "0"
: "auto";

const marginEnd = (justifyContent: AlignItems) =>
const marginEnd = (justifyContent: JustifyContent) =>
justifyContent === "stretch" || justifyContent === "flex-end" ? "0" : "auto";
4 changes: 2 additions & 2 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export type ContentDistribution =

export type ContentPosition = "center" | "flex-end" | "flex-start";

export type AlignContent = ContentDistribution | ContentPosition;
export type AlignContent = "stretch" | ContentDistribution | ContentPosition;

export type AlignItems = "stretch" | ContentPosition;

export type AlignSelf = "stretch" | ContentPosition;

export type JustifyContent = ContentDistribution | ContentPosition;
export type JustifyContent = "stretch" | ContentDistribution | ContentPosition;

export const contentPositions: ContentPosition[] = [
"flex-start",
Expand Down
16 changes: 13 additions & 3 deletions packages/web/src/Flex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export class Flex extends LitElement {
* Direction
* ===================================
*/
:host(:not([direction])), :host([direction="row"]) {
:host(:not([direction])),
:host([direction="row"]) {
flex-direction: row;
--moblin-direction: column;
}
Expand Down Expand Up @@ -83,6 +84,9 @@ export class Flex extends LitElement {
:host([align-content="space-evenly"]) {
align-content: space-evenly;
}
:host([align-content="stretch"]) {
align-content: stretch;
}
/* =================================== */
/**
Expand All @@ -107,6 +111,9 @@ export class Flex extends LitElement {
:host([justify-content="space-evenly"]) {
justify-content: space-evenly;
}
:host([justify-content="stretch"]) {
justify-content: stretch;
}
/* =================================== */
/**
Expand Down Expand Up @@ -140,14 +147,17 @@ export class Flex extends LitElement {
/**
* x-flex-item and child min width/height normalization
*/
:host(:not([direction])), :host([direction="row"]), :host([direction="row-reverse"]) {
:host(:not([direction])),
:host([direction="row"]),
:host([direction="row-reverse"]) {
--moblin-item-min-width: 0;
--moblin-item-min-height: auto;
--moblin-child-min-width: auto;
--moblin-child-min-height: 0;
}
:host([direction="column"]), :host([direction="column-reverse"]) {
:host([direction="column"]),
:host([direction="column-reverse"]) {
--moblin-item-min-width: auto;
--moblin-item-min-height: 0;
--moblin-child-min-width: 0;
Expand Down

0 comments on commit c8c767e

Please sign in to comment.