Skip to content
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

Main site components #104

Merged
merged 50 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
437e957
Add components for first section of main site
0xTim Jan 9, 2023
7a35241
Fix styling of title and caption
0xTim Jan 9, 2023
1896096
Get main callout buttons working
0xTim Jan 10, 2023
57c3ae8
Style the main page callouts on mobile
0xTim Jan 10, 2023
b996015
Style the code demo
0xTim Jan 10, 2023
ef84596
Get start of main page working on mobile and in color modes and spilt…
0xTim Jan 10, 2023
5e33aeb
Get used by logos working
0xTim Jan 11, 2023
6df4057
Fix spacing
0xTim Jan 11, 2023
0c596a3
Add Mastodon Link to site
0xTim Jan 12, 2023
01ad85b
Add rel links to social accounts
0xTim Jan 12, 2023
3c90cc0
Add cards
0xTim Jan 12, 2023
a9dfcdb
Get Vapor cards working
0xTim Jan 12, 2023
9f33cae
Get next section looking OK
0xTim Jan 13, 2023
82274ec
Correct styling of code examples
0xTim Jan 16, 2023
22c0366
Don't try and connect to STS if in testing
0xTim Jan 16, 2023
50f8fb4
Sort out code examples styling
0xTim Jan 17, 2023
add2502
Create some components and add details to code examples
ptoffy Mar 7, 2023
5d2adef
Make code error block responsive
ptoffy Mar 12, 2023
2778983
Make code blocks outline decoration responsive
ptoffy Mar 12, 2023
c291550
Major changes
ptoffy Jun 28, 2023
595ff0e
Should be done
ptoffy Jul 23, 2023
4ff4629
Add some pics and adjust stuff
ptoffy Jul 24, 2023
98524cd
Merge branch 'main' into main-site-components
ptoffy Jul 25, 2023
e931849
Merge branch 'main' into main-site-components
0xTim Jul 25, 2023
f9a1e1c
Update CI with correct S3 api rules
ptoffy Jul 28, 2023
198f5e0
Update highlight.js
ptoffy Jul 28, 2023
03c2c14
Update CI
ptoffy Jul 28, 2023
c8a1cbe
Update CI
ptoffy Aug 5, 2023
5d17022
Update CI
ptoffy Aug 5, 2023
8da2c4b
Update CI...
ptoffy Aug 5, 2023
4c90b6c
Add scrolling navbar and fix some colors
ptoffy Aug 5, 2023
4da6381
Update ci.yaml (#108)
gwynne Aug 7, 2023
ee38afc
Merge branch 'main' into main-site-components
gwynne Aug 7, 2023
9a1ac69
Gwynne is very slow on the uptake
gwynne Aug 7, 2023
340e8d5
Fix some (though not all) issues
ptoffy Aug 21, 2023
fb0149d
Merge branch 'main' into main-site-components
ptoffy Mar 31, 2024
c247433
Tighten up spacing
ptoffy Mar 31, 2024
3e0db3d
Use SASS variable for colour
ptoffy Mar 31, 2024
9c6147d
Update webpack config
ptoffy Apr 2, 2024
a5c752a
Update CI
ptoffy Apr 3, 2024
1badc9b
Try using different S3 workflow
ptoffy Apr 4, 2024
ce6f9ef
Update CI
ptoffy Apr 4, 2024
b72ba63
Use relative paths
ptoffy Apr 4, 2024
e002199
Update webpack config
ptoffy Apr 4, 2024
597b15a
Update CI
ptoffy Apr 8, 2024
28d40b6
Update CI
ptoffy Apr 8, 2024
c07fc5c
Update CI and webpack config
ptoffy Apr 8, 2024
7166a0c
Merge branch 'main' into main-site-components
ptoffy Apr 8, 2024
b78f855
Update background compat
ptoffy Apr 8, 2024
74baad5
Merge branch 'main' into main-site-components
ptoffy Apr 10, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ jobs:
fi
- name: Deploy S3 Website
if: ${{ github.event.pull_request.head.repo.full_name == 'vapor/design' && github.actor != 'dependabot[bot]' }}
uses: rishabhrao/s3-website-https-pr-action@v1
uses: brokenhandsio/s3-website-https-pr-action@1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
bucket-prefix: "vapor-design-pulls"
folder-to-copy: "./Output"
bucket-region: "us-east-1"
299 changes: 297 additions & 2 deletions Sources/DesignSite/DesignTheme.swift

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Sources/DesignSite/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ struct DesignSite: Website {
enum SectionID: String, WebsiteSectionID {
// Add the sections that you want your website to contain here:
case posts
case mainPageDemo
}

struct ItemMetadata: WebsiteItemMetadata {
Expand Down
22 changes: 22 additions & 0 deletions Sources/VaporDesign/Components/MainSite/CompanyCard.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Plot
import Publish

public struct CompanyCard: Component {
let name: String
let url: String
let logo: String

public init(name: String, url: String, logo: String) {
self.name = name
self.url = url
self.logo = logo
}

public var body: Component {
Div {
Link(url: url) {
Span().class("used-by-icon \(logo)").attribute(named: "title", value: name)
}.class("used-by-logo")
}.class("used-by-item")
}
}
40 changes: 40 additions & 0 deletions Sources/VaporDesign/Components/MainSite/FeatureContainer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import Plot
import Publish

public struct FeatureContainer: Component {
let title: String
let description: String
let url: String
let icon: String?
let iconString: String?

public init(title: String, description: String, url: String, icon: String? = nil, iconString: String? = nil) {
self.title = title
self.description = description
self.url = url
self.icon = icon
self.iconString = iconString
}

public var body: Component {
Div {
Div {
if let icon = icon {
Span().class("vapor-icon \(icon)")
} else if let iconString = iconString {
Span(iconString)
}
H2(title)
Paragraph {
Text(description)
}
Button {
Link(url: "https://docs.vapor.codes/") {
Text("Get Started")
Span().class("vapor-icon icon-chevron-right")
}.linkTarget(.blank)
}.class("btn btn-primary w-mobile-100")
}.class("code-example-explainer")
}.class("col order-2 order-lg-1 g-lg-0")
}
}
30 changes: 30 additions & 0 deletions Sources/VaporDesign/Components/MainSite/PackageCard.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Plot
import Publish

public struct PackageCard: Component {
public let title: String
public let description: String
public let icon: String
public let url: String

public init(title: String, description: String, icon: String, url: String) {
self.title = title
self.description = description
self.icon = icon
self.url = url
}

public var body: Component {
Div {
Div {
Span().class("vapor-icon feature-card-icon icon-\(icon)")
H3(title).class("card-title")
Paragraph(description).class("card-text")
Link(url: url) {
Text("Learn More")
Span().class("vapor-icon icon-chevron-right")
}.linkTarget(.blank).class("learn-more-link")
}
}.class("card h-100 vapor-feature-card")
}
}
32 changes: 32 additions & 0 deletions Sources/VaporDesign/Components/MainSite/ShowcaseCard.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Plot
import Publish

public struct ShowcaseCard: Component {
let name: String
let url: String
let image: String
let description: String

public init(name: String, url: String, image: String, description: String) {
self.name = name
self.url = url
self.image = image
self.description = description
}

public var body: Component {
Div {
Image(url: image, description: "\(name) Card").class("card-img-top")
Div {
H5(name).class("card-title")
Paragraph(description).class("card-text")
Link(url: url) {
Text("See it in action")
Span("").class("vapor-icon icon-arrow-narrow-up-right")
}.class("btn btn-primary mt-auto")
}.class("card-body d-flex flex-column")
}.class("card")
.style("width: 18rem;")
.id("\(name.lowercased().replacingOccurrences(of: " ", with: "-"))-card")
}
}
30 changes: 30 additions & 0 deletions Sources/VaporDesign/Components/MainSite/SponsorCard.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import Plot
import Publish

public struct SponsorCard: Component {
let name: String
let url: String
let logo: String
let description: String

public init(name: String, url: String, logo: String, description: String) {
self.name = name
self.url = url
self.logo = logo
self.description = description
}

public var body: Component {
Div {
Div {
Image(url: logo, description: name).class("card-img-top")
H5(name).class("card-title")
Paragraph(description).class("card-text")
Link(url: url) {
Text("Learn More")
Span().class("vapor-icon icon-chevron-right")
}.linkTarget(.blank).class("learn-more-link mt-auto")
}.class("card-body d-flex flex-column")
}.class("card")
}
}
36 changes: 19 additions & 17 deletions Sources/VaporDesign/Components/SiteFooter.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import Plot
import Foundation
import Plot

public struct SiteFooter: Component {

let isLocal: Bool
let isDemo: Bool
let currentSite: CurrentSite

public init(isLocal: Bool = false, isDemo: Bool = false, currentSite: CurrentSite) {
self.isLocal = isLocal
self.isDemo = isDemo
self.currentSite = currentSite
}

public var body: Component {
guard let year = Calendar(identifier: .gregorian).dateComponents([.year], from: Date()).year else {
fatalError("Unable to get the current year")
Expand All @@ -21,9 +20,7 @@ public struct SiteFooter: Component {
Div {
Div {
Div {
Span {

}.class("d-inline-block align-text-top")
Span().class("d-inline-block align-text-top")
.accessibilityLabel("Vapor Logo")
.id("vapor-logo-footer")
.width(197)
Expand All @@ -48,7 +45,7 @@ public struct SiteFooter: Component {
}
}
ListItem {
Link("Join our Discord", url: "https://vapor.team").linkTarget(.blank)
Link("Join our Discord", url: "https://vapor.team").linkTarget(.blank).class("nav-link")
}
ListItem {
if isDemo {
Expand Down Expand Up @@ -89,28 +86,28 @@ public struct SiteFooter: Component {
if currentSite == .blog {
Link("Blog", url: "/")
} else {
Link("Blog", url: "https://blog.vapor.codes").linkTarget(.blank)
Link("Blog", url: "https://blog.vapor.codes").linkTarget(.blank).class("nav-link")
}
}
ListItem {
if currentSite == .docs {
Link("Framework Docs", url: "/")
} else {
Link("Framework Docs", url: "https://docs.vapor.codes").linkTarget(.blank)
Link("Framework Docs", url: "https://docs.vapor.codes").linkTarget(.blank).class("nav-link")
}
}
ListItem {
if currentSite == .apiDocs {
Link("API Docs", url: "/")
Link("API Docs", url: "/").class("nav-link")
} else {
Link("API Docs", url: "https://api.vapor.codes").linkTarget(.blank)
Link("API Docs", url: "https://api.vapor.codes").linkTarget(.blank).class("nav-link")
}
}
ListItem {
Link("Press Kit", url: "https://design.vapor.codes/VaporPressKit.zip").attribute(named: "download", value: nil)
Link("Press Kit", url: "https://design.vapor.codes/VaporPressKit.zip").attribute(named: "download", value: nil).class("nav-link")
}
ListItem {
Link("Help", url: "https://vapor.team").linkTarget(.blank)
Link("Help", url: "https://vapor.team").linkTarget(.blank).class("nav-link")
}
}
}.id("footer-resources-links").class("col-6")
Expand All @@ -122,18 +119,23 @@ public struct SiteFooter: Component {
Div {
Text("© QuTheory, LLC \(year)")
}.id("footer-copyright").class("my-auto")

Div {
List {
ListItem {
Link(url: "https://twitter.com/codevapor") {
Span().class("vapor-icon icon-twitter-fill")
}.linkTarget(.blank)
}.linkTarget(.blank).attribute(named: "rel", value: "me")
}.class("me-4")
ListItem {
Link(url: "https://hachyderm.io/@codevapor") {
Span().class("vapor-icon icon-mastodon-fill")
}.linkTarget(.blank).attribute(named: "rel", value: "me")
}.class("me-4")
ListItem {
Link(url: "https://github.com/vapor") {
Span().class("vapor-icon icon-github-fill")
}.linkTarget(.blank)
}.linkTarget(.blank).attribute(named: "rel", value: "me")
}
}.class("d-flex")
}.id("footer-social-links").class("ms-auto")
Expand Down
2 changes: 1 addition & 1 deletion Sources/VaporDesign/Components/SiteNavigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public struct SiteNavigation<Site: Website>: Component {
ListItem {
Link(url: "https://github.com/vapor") {
Span().class("vapor-icon icon-github-fill")
}.linkTarget(.blank).class("nav-link")
}.linkTarget(.blank).class("nav-link").attribute(named: "rel", value: "me")
}.class("nav-item")
ListItem {
Link(url: "#") {
Expand Down
16 changes: 9 additions & 7 deletions Sources/VaporDesign/VaporDesign.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,38 @@ import Plot
import Publish

public struct VaporDesign<Site: Website> {

let siteLanguage: Language
let isLocal: Bool
let isMainSite: Bool

public init(siteLanguage: Language, isLocal: Bool = false, isMainSite: Bool = false) {
self.siteLanguage = siteLanguage
self.isLocal = isLocal
self.isMainSite = isMainSite
}

public func buildHTML(for page: Location, context: PublishingContext<Site>, body: Node<HTML.DocumentContext>) -> HTML {
HTML(
.lang(siteLanguage),
buildHead(for: page, context: context),
body
)
}

func buildHead(for page: Location, context: PublishingContext<Site>) -> Node<HTML.DocumentContext> {
let head = Node.head(
for: page,
on: context.site,
stylesheetPaths: [
Path(VaporDesignUtilities.buildResourceLink(for: "/main.css", isLocal: isLocal))
Path(VaporDesignUtilities.buildResourceLink(for: "/main.css", isLocal: isLocal)),
],
scripts: [
Path(VaporDesignUtilities.buildResourceLink(for: "/js/detectColorScheme.js", isLocal: isLocal))
Path(VaporDesignUtilities.buildResourceLink(for: "/js/detectColorScheme.js", isLocal: isLocal)),
Path(VaporDesignUtilities.buildResourceLink(for: "/js/scrollMainSiteShowcase.js", isLocal: isLocal)),
Path(VaporDesignUtilities.buildResourceLink(for: "/js/mainSiteScrollNavbar.js", isLocal: isLocal)),
],
isLocal: isLocal)
isLocal: isLocal
)
return head
}
}
3 changes: 3 additions & 0 deletions src/images/allegro.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/api-docs-background-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading