Skip to content

Commit

Permalink
Display support link on author component
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiriVulpes committed Dec 30, 2024
1 parent ad6069e commit 0504578
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ui/component/Author.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { AuthorFull } from "api.fluff4.me"
import Component from "ui/Component"
import Block from "ui/component/core/Block"
import ExternalLink from "ui/component/core/ExternalLink"
import Slot from "ui/component/core/Slot"

export default Component.Builder((component, author: AuthorFull) => {
Expand Down Expand Up @@ -32,5 +33,11 @@ export default Component.Builder((component, author: AuthorFull) => {
}))
.appendTo(block.content)

if (author.support_link && author.support_message)
ExternalLink(author.support_link)
.style("author-support-link")
.text.set(author.support_message)
.appendTo(block.content)

return block
})
18 changes: 18 additions & 0 deletions src/ui/component/core/ExternalLink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Component from "ui/Component"

interface ExternalLinkExtensions {

}

interface ExternalLink extends Component, ExternalLinkExtensions { }

const ExternalLink = Component.Builder("a", (component, href: string | undefined) => {
component.style("link", "link-external")

if (href !== undefined)
component.attributes.set("href", href)

return component
})

export default ExternalLink
4 changes: 4 additions & 0 deletions style/component/author.chiri
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
&-pronouns:

&-description:

&-support-link:
%block
%margin-top-4
8 changes: 8 additions & 0 deletions style/component/core/link.chiri
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@
%colour-0
text-decoration-color: $colour-0
$transition-duration: $transition-focus

&-external:

@after:
%font-font-awesome
%vertical-align-super
content: " #{get-icon("up-right-from-square")}"
font-size: .5em

0 comments on commit 0504578

Please sign in to comment.