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
24 changes: 24 additions & 0 deletions site/src/components/Resources/ResourceCard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Story } from "@storybook/react"
import {
MockWorkspace,
MockWorkspaceAgent,
MockWorkspaceApp,
MockWorkspaceResource,
} from "testHelpers/entities"
import { ResourceCard, ResourceCardProps } from "./ResourceCard"
Expand Down Expand Up @@ -35,6 +36,29 @@ HideSSHButton.args = {
hideSSHButton: true,
}

export const BunchOfApps = Template.bind({})
BunchOfApps.args = {
...Example.args,
resource: {
...MockWorkspaceResource,
agents: [
{
...MockWorkspaceAgent,
apps: [
MockWorkspaceApp,
MockWorkspaceApp,
MockWorkspaceApp,
MockWorkspaceApp,
MockWorkspaceApp,
MockWorkspaceApp,
MockWorkspaceApp,
MockWorkspaceApp,
],
},
],
},
}

export const BunchOfMetadata = Template.bind({})
BunchOfMetadata.args = {
...Example.args,
Expand Down
8 changes: 7 additions & 1 deletion site/src/components/Resources/ResourceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,13 @@ export const ResourceCard: FC<ResourceCardProps> = ({
</div>
</Stack>

<Stack direction="row" alignItems="center" spacing={0.5}>
<Stack
direction="row"
alignItems="center"
spacing={0.5}
wrap="wrap"
maxWidth="750px"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is maxWidth to prevent the left column from getting squashed? If so I wonder if we could do something like put white-space: nowrap or similar on the left column instead then the right can take up whatever space is left over. For example with the current max-width setting you can still get some wonkiness depending on your screen size:

width

With no-wrap:

nowrap

>
{showApps && agent.status === "connected" && (
<>
{applicationsHost !== undefined && (
Expand Down
4 changes: 4 additions & 0 deletions site/src/components/Stack/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type StackProps = {
spacing?: number
alignItems?: CSSProperties["alignItems"]
justifyContent?: CSSProperties["justifyContent"]
maxWidth?: CSSProperties["maxWidth"]
wrap?: CSSProperties["flexWrap"]
} & React.HTMLProps<HTMLDivElement>

Expand All @@ -25,6 +26,7 @@ const useStyles = makeStyles((theme) => ({
alignItems: ({ alignItems }: StyleProps) => alignItems,
justifyContent: ({ justifyContent }: StyleProps) => justifyContent,
flexWrap: ({ wrap }: StyleProps) => wrap,
maxWidth: ({ maxWidth }: StyleProps) => maxWidth,

[theme.breakpoints.down("sm")]: {
width: "100%",
Expand All @@ -39,6 +41,7 @@ export const Stack: FC<StackProps & { children: ReactNode | ReactNode[] }> = ({
spacing = 2,
alignItems,
justifyContent,
maxWidth,
wrap,
...divProps
}) => {
Expand All @@ -48,6 +51,7 @@ export const Stack: FC<StackProps & { children: ReactNode | ReactNode[] }> = ({
alignItems,
justifyContent,
wrap,
maxWidth,
})

return (
Expand Down