- Notifications
You must be signed in to change notification settings - Fork926
refactor(site): improve templates empty state#10518
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
11 commits Select commitHold shift + click to select a range
e3a351e
Redirects to template after setup
BrunoQuaresmacae37d5
Refactor template example cards and first create template experience
BrunoQuaresmad8987b9
Minor improvements
BrunoQuaresmabdb43c6
Fix verbiage
BrunoQuaresma4109264
Fix test
BrunoQuaresma935b09b
Fix template display name on card
BrunoQuaresma250f764
Refactor card layout
BrunoQuaresma817c01f
Merge branch 'main' of https://github.com/coder/coder into bq/improve…
BrunoQuaresma6acd193
Move readmore to be inline
BrunoQuaresmadb54495
Merge branch 'main' of https://github.com/coder/coder into bq/improve…
BrunoQuaresma7453346
Decrease line height
BrunoQuaresmaFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
189 changes: 113 additions & 76 deletionssite/src/components/TemplateExampleCard/TemplateExampleCard.tsx
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,86 +1,123 @@ | ||
import Button from "@mui/material/Button"; | ||
import Link from "@mui/material/Link"; | ||
import type { TemplateExample } from "api/typesGenerated"; | ||
import { Pill } from "components/Pill/Pill"; | ||
import { HTMLProps } from "react"; | ||
import { Link as RouterLink } from "react-router-dom"; | ||
typeTemplateExampleCardProps = { | ||
example: TemplateExample; | ||
activeTag?: string; | ||
} & HTMLProps<HTMLDivElement>; | ||
export const TemplateExampleCard = (props: TemplateExampleCardProps) => { | ||
const { example, activeTag, ...divProps } = props; | ||
return ( | ||
<div | ||
css={(theme) => ({ | ||
width: "320px", | ||
padding: 24, | ||
borderRadius: 6, | ||
border: `1px solid ${theme.palette.divider}`, | ||
textAlign: "left", | ||
textDecoration: "none", | ||
color: "inherit", | ||
display: "flex", | ||
flexDirection: "column", | ||
})} | ||
{...divProps} | ||
> | ||
<div | ||
css={{ | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "space-between", | ||
marginBottom: 24, | ||
}} | ||
> | ||
<div | ||
css={{ | ||
flexShrink: 0, | ||
paddingTop: 4, | ||
width: 32, | ||
height: 32, | ||
}} | ||
> | ||
<img | ||
src={example.icon} | ||
alt="" | ||
css={{ width: "100%", height: "100%", objectFit: "contain" }} | ||
/> | ||
</div> | ||
<div css={{ display: "flex", flexWrap: "wrap", gap: 8 }}> | ||
{example.tags.map((tag) => { | ||
const isActive = activeTag === tag; | ||
return ( | ||
<RouterLink key={tag} to={`/starter-templates?tag=${tag}`}> | ||
<Pill | ||
text={tag} | ||
css={(theme) => ({ | ||
borderColor: isActive | ||
? theme.palette.primary.main | ||
: theme.palette.divider, | ||
cursor: "pointer", | ||
backgroundColor: isActive | ||
? theme.palette.primary.dark | ||
: undefined, | ||
"&: hover": { | ||
borderColor: theme.palette.primary.main, | ||
}, | ||
})} | ||
/> | ||
</RouterLink> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
<div> | ||
<h4 css={{ fontSize: 14, fontWeight: 600, margin: 0, marginBottom: 4 }}> | ||
{example.name} | ||
</h4> | ||
<span | ||
css={(theme) => ({ | ||
fontSize: 13, | ||
color: theme.palette.text.secondary, | ||
lineHeight: "1.6", | ||
display: "block", | ||
})} | ||
> | ||
{example.description}{" "} | ||
<Link | ||
component={RouterLink} | ||
to={`/starter-templates/${example.id}`} | ||
css={{ display: "inline-block", fontSize: 13, marginTop: 4 }} | ||
> | ||
Read more | ||
</Link> | ||
</span> | ||
</div> | ||
<div | ||
css={{ | ||
display: "flex", | ||
gap: 12, | ||
flexDirection: "column", | ||
paddingTop: 24, | ||
marginTop: "auto", | ||
alignItems: "center", | ||
}} | ||
> | ||
<Button | ||
component={RouterLink} | ||
fullWidth | ||
to={`/templates/new?exampleId=${example.id}`} | ||
> | ||
Use template | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; |
6 changes: 3 additions & 3 deletionssite/src/pages/SetupPage/SetupPage.test.tsx
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
2 changes: 1 addition & 1 deletionsite/src/pages/SetupPage/SetupPage.tsx
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
37 changes: 20 additions & 17 deletionssite/src/pages/StarterTemplatesPage/StarterTemplatesPageView.tsx
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
36 changes: 9 additions & 27 deletionssite/src/pages/TemplatesPage/EmptyTemplates.tsx
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
2 changes: 1 addition & 1 deletionsite/src/pages/WorkspacesPage/WorkspacesEmpty.tsx
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
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.