flotilla/src/app/components/ProfileLink.svelte

26 lines
715 B
Svelte
Raw Normal View History

2025-02-06 19:12:15 +00:00
<script lang="ts">
2025-06-05 15:35:17 +00:00
import cx from "classnames"
2025-02-06 19:12:15 +00:00
import {preventDefault} from "@lib/html"
import Button from "@lib/components/Button.svelte"
import ProfileName from "@app/components/ProfileName.svelte"
import ProfileDetail from "@app/components/ProfileDetail.svelte"
import {pushModal} from "@app/util/modal"
2025-02-06 19:12:15 +00:00
2025-04-15 18:03:27 +00:00
type Props = {
pubkey: string
url?: string
2025-07-04 13:22:19 +00:00
class?: string
2025-06-05 03:42:28 +00:00
unstyled?: boolean
2025-04-15 18:03:27 +00:00
}
2025-02-06 19:12:15 +00:00
2025-07-04 13:22:19 +00:00
const {pubkey, url, unstyled, ...props}: Props = $props()
2025-04-15 18:03:27 +00:00
const openProfile = () => pushModal(ProfileDetail, {pubkey, url})
2025-02-06 19:12:15 +00:00
</script>
2025-10-06 18:23:19 +00:00
<Button
onclick={preventDefault(openProfile)}
class={cx(props.class, {"link-content bg-alt": !unstyled})}>
2025-04-15 18:03:27 +00:00
@<ProfileName {pubkey} {url} />
2025-02-06 19:12:15 +00:00
</Button>