Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: Page header width in the workspace page #2125

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 1 commit into from
Jun 7, 2022
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
fix: Page header width in the workspace page
  • Loading branch information
BrunoQuaresma committed Jun 7, 2022
commit 734f5f9aa5c4b6632a041c9d7bf6560754dcd378
6 changes: 4 additions & 2 deletions site/src/components/PageHeader/PageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { makeStyles } from "@material-ui/core/styles"
import { combineClasses } from "../../util/combineClasses"
import { Stack } from "../Stack/Stack"

export interface PageHeaderProps {
actions?: JSX.Element
className?: string
}

export const PageHeader: React.FC<PageHeaderProps> = ({ children, actions }) => {
export const PageHeader: React.FC<PageHeaderProps> = ({ children, actions, className }) => {
const styles = useStyles()

return (
<div className={styles.root}>
<div className={combineClasses([styles.root, className])}>
<hgroup>{children}</hgroup>
<Stack direction="row" className={styles.actions}>
{actions}
Expand Down
22 changes: 6 additions & 16 deletions site/src/components/Workspace/Workspace.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { makeStyles } from "@material-ui/core/styles"
import { FC } from "react"
import * as TypesGen from "../../api/typesGenerated"
import { MONOSPACE_FONT_FAMILY } from "../../theme/constants"
import { BuildsTable } from "../BuildsTable/BuildsTable"
import { Margins } from "../Margins/Margins"
import { PageHeader, PageHeaderSubtitle, PageHeaderTitle } from "../PageHeader/PageHeader"
Expand Down Expand Up @@ -49,6 +48,7 @@ export const Workspace: FC<WorkspaceProps> = ({
return (
<Margins>
<PageHeader
className={styles.header}
actions={
<WorkspaceActions
workspace={workspace}
Expand Down Expand Up @@ -89,29 +89,19 @@ export const Workspace: FC<WorkspaceProps> = ({
)
}

const spacerWidth = 300

export const useStyles = makeStyles((theme) => {
return {
firstColumnSpacer: {
flex: 2,
},
secondColumnSpacer: {
flex: "0 0 300px",
flex: `0 0 ${spacerWidth}px`,
},
header: {
paddingTop: theme.spacing(5),
paddingBottom: theme.spacing(5),
fontFamily: MONOSPACE_FONT_FAMILY,
display: "flex",
alignItems: "center",
justifyContent: "space-between",
},
title: {
fontWeight: 600,
fontFamily: "inherit",
},
subtitle: {
fontFamily: "inherit",
marginTop: theme.spacing(0.5),
// 100% - (the size of sidebar + the space between both )
maxWidth: `calc(100% - (${spacerWidth}px + ${theme.spacing(3)}px))`,
},
layout: {
alignItems: "flex-start",
Expand Down