-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/test new design #29
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
Open
fwextensions
wants to merge
9
commits into
main
Choose a base branch
from
feat/test-new-design
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cf34ccf
Add Tailwind
fwextensions b975c09
Add beta components for the new design
fwextensions 6f6166f
Fix text alignment in BigText.astro
fwextensions ff058a9
Add different sizes of BigText
fwextensions a9fe3cb
Clean up NewsSummary and FooterNav
fwextensions 5f5641f
Add beta version of GitHubEvents component that uses Tailwind
fwextensions 0e9fdcb
Ignore the non-pages in beta/
fwextensions f0f02b5
Recreate package-lock.json
fwextensions 2fa5a06
Make sure the latest @astrojs/check is installed
fwextensions 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
Large diffs are not rendered by default.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,99 @@ | ||
--- | ||
import TagOrnament from "./TagOrnament.astro"; | ||
|
||
interface Props { | ||
id?: string; | ||
anchor?: "left" | "right"; | ||
size?: "lg" | "md" | "sm"; | ||
showOrnament?: boolean; | ||
} | ||
|
||
const Sizes = { | ||
lg: { | ||
Heading: "h2", | ||
headingFontSize: "text-9xl", | ||
bodyFontSize: "text-2xl leading-[1.2]", | ||
}, | ||
md: { | ||
Heading: "h3", | ||
headingFontSize: "text-5xl leading-[0.9]", | ||
bodyFontSize: "text-lg leading-[1.2]", | ||
}, | ||
sm: { | ||
Heading: "h4", | ||
headingFontSize: "text-2xl", | ||
bodyFontSize: "text-base", | ||
}, | ||
}; | ||
|
||
const { | ||
id, | ||
anchor = "left", | ||
size = "lg", | ||
showOrnament = true, | ||
} = Astro.props; | ||
const { Heading, headingFontSize, bodyFontSize } = Sizes[size]; | ||
--- | ||
|
||
<section id={id} class="py-4"> | ||
<div | ||
class:list={[ | ||
"flex", | ||
"items-center", | ||
"justify-between", | ||
"gap-10", | ||
{ "flex-row-reverse": anchor === "right" }, | ||
]} | ||
> | ||
<Heading | ||
class:list={[ | ||
"flex-1", | ||
"font-condensed", | ||
"font-semibold", | ||
"uppercase", | ||
headingFontSize, | ||
"leading-[0.8]", | ||
"mb-0", | ||
anchor === "left" && "text-right", | ||
]} | ||
> | ||
<slot name="title" /> | ||
</Heading> | ||
<div | ||
class:list={[ | ||
"body", | ||
"flex-1", | ||
"text-stone-800", | ||
bodyFontSize, | ||
anchor === "right" && "text-right", | ||
]} | ||
> | ||
<slot name="body" /> | ||
</div> | ||
</div> | ||
{showOrnament && ( | ||
<div class="flex justify-center mt-8"> | ||
<TagOrnament /> | ||
</div> | ||
)} | ||
</section> | ||
|
||
<style> | ||
h2, h3, h4 { | ||
:global(b) { | ||
color: var(--color-sf-red); | ||
font-weight: inherit; | ||
} | ||
} | ||
Comment on lines
+82
to
+87
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. |
||
|
||
div.body { | ||
:global(p:last-of-type) { | ||
margin-bottom: 0; | ||
} | ||
|
||
:global(i) { | ||
color: var(--color-stone-600); | ||
font-weight: 600; | ||
} | ||
} | ||
</style> |
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,40 @@ | ||
--- | ||
interface Props { | ||
color: string; | ||
title: string; | ||
body: string; | ||
label: string; | ||
href: string; | ||
} | ||
|
||
const { color, title, body, label, href } = Astro.props; | ||
--- | ||
|
||
<div class="flex flex-col items-center text-center p-8 rounded-lg" style={`background: ${color}`}> | ||
<div class="w-3/5 mb-4"> | ||
<slot /> | ||
</div> | ||
<div class="flex flex-col h-full gap-2"> | ||
<h3 class="text-white font-[var(--font-barlow-condensed)] uppercase text-2xl font-bold min-h-[3rem]">{title}</h3> | ||
<p class="text-white text-sm h-full mb-4"> | ||
{body} | ||
</p> | ||
<a href={href} target="_blank" class="text-white font-bold text-lg hover:underline decoration-white/90"> | ||
{label} | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<style> | ||
@media only screen and (max-width: 768px) { | ||
div { | ||
@apply flex-row justify-between; | ||
} | ||
div > div:first-child { | ||
@apply w-1/3; | ||
} | ||
div > div:last-child { | ||
@apply w-3/5; | ||
} | ||
} | ||
</style> |
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,30 @@ | ||
--- | ||
import GitHubEvents from "./GitHubEvents/GitHubEvents"; | ||
import TagOrnament from "./TagOrnament.astro"; | ||
import BigText from "./BigText.astro"; | ||
|
||
// we'll pass the ID of the section to the GitHubEvents component so that it can | ||
// hide the whole section in case there's an error, rather than leave a broken | ||
// component on the page | ||
const id = "in-the-code"; | ||
const showOrnament = false; | ||
--- | ||
|
||
<section id={id} class="mb-8"> | ||
<BigText size="md" showOrnament={false}> | ||
<Fragment slot="title"> | ||
<b>In the Code</b> | ||
</Fragment> | ||
</BigText> | ||
<div class="mt-5" /> | ||
<GitHubEvents | ||
org="sfbrigade" | ||
sectionID={id} | ||
client:only="react" | ||
/> | ||
{showOrnament && ( | ||
<div class="flex justify-center mt-16"> | ||
<TagOrnament /> | ||
</div> | ||
)} | ||
</section> |
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,66 @@ | ||
--- | ||
import { Icon } from "astro-icon/components"; | ||
import NavLink from "./NavLink.astro"; | ||
import { | ||
facebookURL, | ||
githubURL, | ||
linkedinURL, | ||
meetupURL, | ||
pitchProjectURL, | ||
proposeTalkURL, | ||
slackURL, | ||
blueskyURL, | ||
twitterURL | ||
} from "@/utils/urls"; | ||
|
||
const columns = [ | ||
[ | ||
"Resources", | ||
[ | ||
[proposeTalkURL, "propose a talk"], | ||
[pitchProjectURL, "pitch a project"], | ||
], | ||
], | ||
[ | ||
"About", | ||
[ | ||
["/about", "about"], | ||
["/about#core-team", "meet the core team"], | ||
["/about#code-of-conduct", "code of conduct"], | ||
["mailto:hello@sfcivictech.org", "contact"], | ||
], | ||
], | ||
[ | ||
"Elsewhere", | ||
[ | ||
[githubURL, "github", "fa:github"], | ||
[slackURL, "slack", "fa:slack"], | ||
[meetupURL, "meetup", "fa:meetup"], | ||
[blueskyURL, "bluesky", "fa6-brands:bluesky"], | ||
[facebookURL, "facebook", "fa:facebook"], | ||
[linkedinURL, "linkedin", "fa:linkedin"], | ||
[twitterURL, "twitter", "fa6-brands:twitter"], | ||
], | ||
], | ||
] as const; | ||
--- | ||
|
||
<footer class="mx-auto px-0 py-14 text-sm flex flex-row justify-between"> | ||
{columns.map(([cat, links]) => ( | ||
<nav aria-label="Footer" class="flex flex-col justify-start"> | ||
<h3 class="text-primary text-lg font-condensed font-bold uppercase mb-2">{cat}</h3> | ||
<ul class="block list-none p-0 m-0"> | ||
{links.map(([page, label, iconName]) => ( | ||
<li class="hover:text-primary pb-1 flex items-center gap-1"> | ||
{iconName && | ||
<Icon name={iconName} class="inline-block min-w-6 text-center align-baseline" /> | ||
} | ||
<NavLink href={page}> | ||
{label} | ||
</NavLink> | ||
</li> | ||
))} | ||
</ul> | ||
</nav> | ||
))} | ||
</footer> |
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,38 @@ | ||
import { Component, type ErrorInfo, type ReactNode } from "react"; | ||
|
||
interface ErrorBoundaryProps { | ||
onError?: (error: Error, info: ErrorInfo) => void; | ||
fallback?: ReactNode; | ||
children?: ReactNode; | ||
} | ||
|
||
interface ErrorBoundaryState { | ||
hasError: boolean; | ||
} | ||
|
||
export default class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> { | ||
state: ErrorBoundaryState = { | ||
hasError: false | ||
} | ||
|
||
static getDerivedStateFromError(_: Error) | ||
{ | ||
return { hasError: true }; | ||
} | ||
|
||
componentDidCatch( | ||
error: Error, | ||
errorInfo: React.ErrorInfo) | ||
{ | ||
this.props.onError?.(error, errorInfo); | ||
} | ||
|
||
render() | ||
{ | ||
if (this.state.hasError) { | ||
return this.props.fallback; | ||
} | ||
|
||
return this.props.children; | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/pages/beta/_components/GitHubEvents/EventProcessors.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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
export const EventProcessors = [ | ||
{ | ||
type: "PushEvent", | ||
process( | ||
event: any, | ||
repo: string) | ||
{ | ||
const { actor, payload, created_at } = event; | ||
|
||
return payload.commits.map((commit: any) => ({ | ||
id: commit.sha, | ||
repo, | ||
username: actor.display_login, | ||
avatar: actor.avatar_url, | ||
message: commit.message, | ||
// you can get to the html_url value if you call another API, but to | ||
// make things easier, just create that URL manually | ||
link: commit.url | ||
.replace("api.", "") | ||
.replace("/repos", "") | ||
.replace("/commits/", "/commit/"), | ||
timestamp: created_at, | ||
})); | ||
} | ||
}, | ||
{ | ||
type: "PullRequestEvent", | ||
process( | ||
event: any, | ||
repo: string) | ||
{ | ||
const { | ||
id, | ||
actor, | ||
payload: { action, pull_request }, | ||
created_at | ||
} = event; | ||
|
||
return { | ||
id, | ||
repo, | ||
username: actor.login, | ||
avatar: actor.avatar_url, | ||
message: <><strong>PR {action}:</strong> {pull_request.title}</>, | ||
tooltip: `PR ${action}: ${pull_request.title}`, | ||
link: pull_request.html_url, | ||
timestamp: created_at, | ||
}; | ||
} | ||
}, | ||
{ | ||
type: "IssuesEvent", | ||
process( | ||
event: any, | ||
repo: string) | ||
{ | ||
const { id, actor, payload: { action, issue }, created_at } = event; | ||
|
||
return { | ||
id, | ||
repo, | ||
username: actor.login, | ||
avatar: actor.avatar_url, | ||
message: <><strong>Issue {action}:</strong> {issue.title}</>, | ||
tooltip: `Issue ${action}: ${issue.title}`, | ||
link: issue.html_url, | ||
timestamp: created_at, | ||
}; | ||
} | ||
}, | ||
]; |
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.
Consider adding a comment explaining why Tailwind CSS is being added as a plugin. This can help future developers understand the purpose of this configuration.