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

[MIRROR] TGUI Stack Zebra Mode #1020

Merged
merged 1 commit into from
Dec 7, 2023
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: 3 additions & 1 deletion tgui/packages/tgui/components/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import { computeFlexClassName, computeFlexItemClassName, computeFlexItemProps, c
type StackProps = FlexProps & {
vertical?: boolean;
fill?: boolean;
zebra?: boolean;
};

export const Stack = (props: StackProps) => {
const { className, vertical, fill, ...rest } = props;
const { className, vertical, fill, zebra, ...rest } = props;
return (
<div
className={classes([
'Stack',
fill && 'Stack--fill',
vertical ? 'Stack--vertical' : 'Stack--horizontal',
zebra && 'Stack--zebra',
className,
computeFlexClassName(props),
])}
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/stories/Stack.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Story = (props) => {
<Stack fill className="debug-layout">
<SmallStackItems />
<Stack.Item grow={1}>
<Stack fill vertical>
<Stack fill vertical zebra>
<SmallStackItems />
<Stack.Item>
<Stack fill>
Expand Down
6 changes: 6 additions & 0 deletions tgui/packages/tgui/styles/components/Stack.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
@use '../base.scss';
@use './Divider.scss';

$zebra-background-color: base.$color-bg-section !default;

.Stack--fill {
height: 100%;
}
Expand All @@ -26,6 +28,10 @@
}
}

.Stack--zebra > .Stack__item:nth-child(even) {
background-color: $zebra-background-color;
}

.Stack--horizontal > .Stack__divider:not(.Stack__divider--hidden) {
border-left: Divider.$thickness solid Divider.$color;
}
Expand Down
Loading