Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: WorkspaceSection action#1623

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
greyscaled merged 1 commit intomainfromvapurrmaid/gh-1455/part-1/refactors
May 20, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
10 changes: 6 additions & 4 deletionssite/src/components/Workspace/Workspace.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,13 +9,11 @@ import { WorkspaceSection } from "../WorkspaceSection/WorkspaceSection"
import { WorkspaceStatusBar } from "../WorkspaceStatusBar/WorkspaceStatusBar"

export interface WorkspaceProps {
organization?: TypesGen.Organization
workspace: TypesGen.Workspace
template?: TypesGen.Template
handleStart: () => void
handleStop: () => void
handleRetry: () => void
handleUpdate: () => void
workspace: TypesGen.Workspace
Comment on lines -12 to +16
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Review:

  • oraganization andtemplate were unused (note this is one caveat when a prop is optional, we don't really know if we're even using it. I wonder if there's a lint rule that can help with that, but suffice it to say I just checked which of these the component was de-structuring. Also this is why de-structuringprops is superior to theprop arg...it's helpful to see where everything is being used with a simple find/replace).
  • Furthermore, the grouping was odd. I'll add a note about organizing props in our FE V, but essentially, I think what I see in most codebases is alphabetical but mandatory props are grouped in front of optional props. We can also use a different convention, what matters to me is "at a glance" behaviors. Mix-n-match requires more brain power to read.

jsjoeio reacted with thumbs up emoji
workspaceStatus: WorkspaceStatus
builds?: TypesGen.WorkspaceBuild[]
}
Expand All@@ -24,11 +22,11 @@ export interface WorkspaceProps {
* Workspace is the top-level component for viewing an individual workspace
*/
export const Workspace: React.FC<WorkspaceProps> = ({
workspace,
handleStart,
handleStop,
handleRetry,
handleUpdate,
workspace,
workspaceStatus,
builds,
}) => {
Expand All@@ -45,19 +43,23 @@ export const Workspace: React.FC<WorkspaceProps> = ({
handleUpdate={handleUpdate}
workspaceStatus={workspaceStatus}
/>

<div className={styles.horizontal}>
<div className={styles.sidebarContainer}>
<WorkspaceSection title="Applications">
<Placeholder />
</WorkspaceSection>
<WorkspaceSchedule workspace={workspace} />

<WorkspaceSection title="Dev URLs">
<Placeholder />
</WorkspaceSection>

<WorkspaceSection title="Resources">
<Placeholder />
</WorkspaceSection>
</div>

Copy link
ContributorAuthor

@greyscaledgreyscaledMay 20, 2022
edited
Loading

Choose a reason for hiding this comment

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

Review: Will add this to FE V and search for lint rule. zero spaces in HTML markup makes me dizzy!

jsjoeio reacted with thumbs up emoji
<div className={styles.timelineContainer}>
<WorkspaceSection title="Timeline" contentsProps={{ className: styles.timelineContents }}>
<BuildsTable builds={builds} className={styles.timelineTable} />
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
import IconButton from "@material-ui/core/IconButton"
import EditIcon from "@material-ui/icons/Edit"
import { action } from "@storybook/addon-actions"
import { Story } from "@storybook/react"
import React from "react"
import { WorkspaceSection, WorkspaceSectionProps } from "./WorkspaceSection"

export default {
title: "components/WorkspaceSection",
component: WorkspaceSection,
}

const Template: Story<WorkspaceSectionProps> = (args) => <WorkspaceSection {...args}>Content</WorkspaceSection>

export const NoAction = Template.bind({})
NoAction.args = {
title: "A Workspace Section",
}

export const Action = Template.bind({})
Action.args = {
action: (
<IconButton onClick={action("edit")}>
<EditIcon />
</IconButton>
),
title: "Action Section",
}
Copy link
ContributorAuthor

@greyscaledgreyscaledMay 20, 2022
edited
Loading

Choose a reason for hiding this comment

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

Review: We forgot to add this story additionally, but now it's here and with two examples. I couldn't think of an example forcontentProps because it's mostly used to inject styles or classes.

jsjoeio reacted with thumbs up emoji
13 changes: 9 additions & 4 deletionssite/src/components/WorkspaceSection/WorkspaceSection.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,19 +6,24 @@ import { CardPadding, CardRadius } from "../../theme/constants"
import { combineClasses } from "../../util/combineClasses"

export interface WorkspaceSectionProps {
title?: string
/**
* action appears in the top right of the section card
*/
action?: React.ReactNode
contentsProps?: HTMLProps<HTMLDivElement>
title?: string
}

export const WorkspaceSection: React.FC<WorkspaceSectionProps> = ({title, children, contentsProps }) => {
export const WorkspaceSection: React.FC<WorkspaceSectionProps> = ({action, children, contentsProps, title }) => {
const styles = useStyles()

return (
<Paperelevation={0}className={styles.root}>
<Paper className={styles.root} elevation={0}>
{title && (
<div className={styles.headerContainer}>
<div className={styles.header}>
<Typography variant="h6">{title}</Typography>
{action && <div>{action}</div>}
</div>
</div>
)}
Expand All@@ -45,7 +50,7 @@ const useStyles = makeStyles((theme) => ({
header: {
alignItems: "center",
display: "flex",
flexDirection: "row",
justifyContent: "space-between",
marginBottom: theme.spacing(1),
marginTop: theme.spacing(1),
paddingLeft: CardPadding + theme.spacing(1),
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp