-
Notifications
You must be signed in to change notification settings - Fork 889
feat(site): refactor workspace header to be more slim #11327
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
84f1bc4
Extract a few components to topbar module
BrunoQuaresma 4ed5550
Extract and refactor a few more topbar componetns
BrunoQuaresma ffacb9f
WIP: Refactor workspace header
BrunoQuaresma a9ac963
Merge branch 'main' of https://github.com/coder/coder into bq/impleme…
BrunoQuaresma 68c13ae
Improve outdated spacing
BrunoQuaresma ba88521
Merge branch 'main' of https://github.com/coder/coder into bq/impleme…
BrunoQuaresma 3796085
Add schedule controls
BrunoQuaresma e0dd30d
Use topbar buttons
BrunoQuaresma c56d2f5
Add dormant to topbar
BrunoQuaresma 90c3fc9
Add quota and minor accessibility improvements
BrunoQuaresma fdda1ba
Make template navigable
BrunoQuaresma f37a88d
Make visual adjustments
BrunoQuaresma 26d6c09
Refactor icon colors
BrunoQuaresma 5fa1f8f
Merge branch 'main' of https://github.com/coder/coder into bq/impleme…
BrunoQuaresma 651b800
Add storybook
BrunoQuaresma d5510b2
Refactor storybook names
BrunoQuaresma d48c501
Merge branch 'main' of https://github.com/coder/coder into bq/impleme…
BrunoQuaresma 19832ee
fix pill usage
BrunoQuaresma b8e80d0
add data-testid to workspace badge
BrunoQuaresma 30f2a8c
Fix workspace status helper
BrunoQuaresma 446bb76
remove span depedency from build-status
BrunoQuaresma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as _storybook_types from "@storybook/react"; | ||
import { Experiments, FeatureName } from "api/typesGenerated"; | ||
import { QueryKey } from "react-query"; | ||
|
||
declare module "@storybook/react" { | ||
interface Parameters { | ||
features?: FeatureName[]; | ||
experiments?: Experiments; | ||
queries?: { key: QueryKey; data: unknown }[]; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { css } from "@emotion/css"; | ||
import Button, { ButtonProps } from "@mui/material/Button"; | ||
import IconButton, { IconButtonProps } from "@mui/material/IconButton"; | ||
import { useTheme } from "@mui/material/styles"; | ||
import { Avatar, AvatarProps } from "components/Avatar/Avatar"; | ||
import { | ||
ForwardedRef, | ||
HTMLAttributes, | ||
PropsWithChildren, | ||
ReactElement, | ||
cloneElement, | ||
forwardRef, | ||
} from "react"; | ||
|
||
export const Topbar = (props: HTMLAttributes<HTMLDivElement>) => { | ||
const theme = useTheme(); | ||
|
||
return ( | ||
<header | ||
{...props} | ||
css={{ | ||
minHeight: 48, | ||
borderBottom: `1px solid ${theme.palette.divider}`, | ||
display: "flex", | ||
alignItems: "center", | ||
fontSize: 13, | ||
lineHeight: "1.2", | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export const TopbarIconButton = forwardRef<HTMLButtonElement, IconButtonProps>( | ||
(props, ref) => { | ||
return ( | ||
<IconButton | ||
ref={ref} | ||
{...props} | ||
size="small" | ||
css={{ | ||
padding: 0, | ||
borderRadius: 0, | ||
height: 48, | ||
width: 48, | ||
|
||
"& svg": { | ||
fontSize: 20, | ||
}, | ||
}} | ||
/> | ||
); | ||
}, | ||
) as typeof IconButton; | ||
|
||
export const TopbarButton = forwardRef<HTMLButtonElement, ButtonProps>( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :) nice |
||
(props: ButtonProps, ref) => { | ||
return ( | ||
<Button | ||
ref={ref} | ||
color="neutral" | ||
css={{ | ||
height: 28, | ||
fontSize: 13, | ||
borderRadius: 4, | ||
padding: "0 12px", | ||
}} | ||
{...props} | ||
/> | ||
); | ||
}, | ||
); | ||
|
||
export const TopbarData = (props: HTMLAttributes<HTMLDivElement>) => { | ||
return ( | ||
<div | ||
{...props} | ||
css={{ | ||
display: "flex", | ||
gap: 8, | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export const TopbarDivider = (props: HTMLAttributes<HTMLSpanElement>) => { | ||
const theme = useTheme(); | ||
return ( | ||
<span {...props} css={{ color: theme.palette.divider }}> | ||
/ | ||
</span> | ||
); | ||
}; | ||
|
||
export const TopbarAvatar = (props: AvatarProps) => { | ||
return ( | ||
<Avatar | ||
{...props} | ||
variant="square" | ||
fitImage | ||
css={{ width: 16, height: 16 }} | ||
/> | ||
); | ||
}; | ||
|
||
type TopbarIconProps = PropsWithChildren<HTMLAttributes<HTMLOrSVGElement>>; | ||
|
||
export const TopbarIcon = forwardRef<HTMLOrSVGElement, TopbarIconProps>( | ||
(props: TopbarIconProps, ref) => { | ||
const { children, ...restProps } = props; | ||
const theme = useTheme(); | ||
|
||
return cloneElement( | ||
children as ReactElement< | ||
HTMLAttributes<HTMLOrSVGElement> & { | ||
ref: ForwardedRef<HTMLOrSVGElement>; | ||
} | ||
>, | ||
{ | ||
...restProps, | ||
ref, | ||
className: css({ fontSize: 16, color: theme.palette.text.disabled }), | ||
}, | ||
); | ||
}, | ||
); |
61 changes: 0 additions & 61 deletions
61
site/src/components/WorkspaceDeletion/DormantDeletionStat.tsx
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from "./DormantDeletionStat"; | ||
export * from "./DormantDeletionText"; | ||
export * from "./DormantWorkspaceBanner"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are we doing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are setting the default values, passed via story parameters, for the react-query queries so the stories don't need to fetch the data. It is used to make the story independent of a BE or API.