Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use direction props from radix.Flex #2696

Merged
merged 5 commits into from
Feb 22, 2024
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
11 changes: 6 additions & 5 deletions reflex/components/radix/themes/layout/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from __future__ import annotations

from reflex.components.component import Component
from reflex.vars import Var

from ..base import LiteralAlign, LiteralSpacing
from .flex import Flex
from .flex import Flex, LiteralFlexDirection


class Stack(Flex):
Expand Down Expand Up @@ -41,12 +42,12 @@ def create(
class VStack(Stack):
"""A vertical stack component."""

def _apply_theme(self, theme: Component):
self.style.update({"flex_direction": "column"})
# The direction of the stack.
direction: Var[LiteralFlexDirection] = "column" # type: ignore


class HStack(Stack):
"""A horizontal stack component."""

def _apply_theme(self, theme: Component):
self.style.update({"flex_direction": "row"})
# The direction of the stack.
direction: Var[LiteralFlexDirection] = "row" # type: ignore
11 changes: 6 additions & 5 deletions reflex/components/radix/themes/layout/stack.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ from reflex.vars import Var, BaseVar, ComputedVar
from reflex.event import EventChain, EventHandler, EventSpec
from reflex.style import Style
from reflex.components.component import Component
from reflex.vars import Var
from ..base import LiteralAlign, LiteralSpacing
from .flex import Flex
from .flex import Flex, LiteralFlexDirection

class Stack(Flex):
@overload
Expand Down Expand Up @@ -178,13 +179,13 @@ class VStack(Stack):
*children,
spacing: Optional[LiteralSpacing] = "2",
align: Optional[LiteralAlign] = "start",
as_child: Optional[Union[Var[bool], bool]] = None,
direction: Optional[
Union[
Var[Literal["row", "column", "row-reverse", "column-reverse"]],
Literal["row", "column", "row-reverse", "column-reverse"],
]
] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
justify: Optional[
Union[
Var[Literal["start", "center", "end", "between"]],
Expand Down Expand Up @@ -296,8 +297,8 @@ class VStack(Stack):
*children: The children of the stack.
spacing: The spacing between each stack item.
align: The alignment of the stack items.
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
access_key: Provides a hint for generating a keyboard shortcut for the current element.
Expand Down Expand Up @@ -337,13 +338,13 @@ class HStack(Stack):
*children,
spacing: Optional[LiteralSpacing] = "2",
align: Optional[LiteralAlign] = "start",
as_child: Optional[Union[Var[bool], bool]] = None,
direction: Optional[
Union[
Var[Literal["row", "column", "row-reverse", "column-reverse"]],
Literal["row", "column", "row-reverse", "column-reverse"],
]
] = None,
as_child: Optional[Union[Var[bool], bool]] = None,
justify: Optional[
Union[
Var[Literal["start", "center", "end", "between"]],
Expand Down Expand Up @@ -455,8 +456,8 @@ class HStack(Stack):
*children: The children of the stack.
spacing: The spacing between each stack item.
align: The alignment of the stack items.
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
direction: How child items are layed out: "row" | "column" | "row-reverse" | "column-reverse"
as_child: Change the default rendered element for the one passed as a child, merging their props and behavior.
justify: Alignment of children along the cross axis: "start" | "center" | "end" | "between"
wrap: Whether children should wrap when they reach the end of their container: "nowrap" | "wrap" | "wrap-reverse"
access_key: Provides a hint for generating a keyboard shortcut for the current element.
Expand Down
Loading