Skip to content
ui8kit

component / components

Post Author

Post Author component

Install

npx ui8kit add post-author

Pulls in: box, button, compose, group, kit-box, kit-button, kit-text, lucide-icon, media-frame, post-card, post-split, stack, text, utils

Preview

Head of Growth

Code

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdn
npx ui8kit add post-author
components/post-author.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line,
  a card, or a card with the bio.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Post } from "../blocks/post-card.types";
  import type { PostExtras, PostSplitLabels } from "../blocks/post-split.types";

  export type PostAuthorProps = {
    post: Post;
    extras: PostExtras;
    labels: PostSplitLabels;
    mode?: "line" | "card" | "bio";
    share?: boolean;
    class?: string;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Button from "../compose/Button.svelte";
  import Group from "../compose/Group.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import { cn } from "../utils";

  let { post, extras, labels, mode = "line", share = false, class: className }: PostAuthorProps = $props();
</script>

<Stack
  gap="4"
  align="stretch"
  class={cn(
    (((mode as string) === "line") ? "" : "rounded bg-card inset-ring inset-ring-border p-4"),
    className
  )}
  data-slot="post-author"
>
  <Group gap="4" align="center">
    <MediaFrame alt={post.author} ratio="1/1" class="size-10 shrink-0 rounded-full" />
    <Stack gap="0" align="start" class="min-w-0 flex-1 text-start">
      <Text size="sm" weight="semibold">
        {post.author}
      </Text>
      <Text size="xs" class="text-muted-foreground">
        {extras.role}
      </Text>
    </Stack>
    {#if share}
      <Group gap="2">
        <Button variant="ghost" size="default" class="gap-2">
          <LucideIcon name="share-2" size={16} />
          {labels.share}
        </Button>
        <Button variant="ghost" size="default" class="gap-2">
          <LucideIcon name="bookmark" size={16} />
          {labels.save}
        </Button>
      </Group>
    {:else}
      <Box class="text-muted-foreground">
        <Group gap="2" align="center">
          <LucideIcon name="calendar" size={16} />
          <Text size="sm">
            {post.date}
          </Text>
        </Group>
      </Box>
    {/if}
  </Group>
  {#if ((mode as string) === "bio")}
    <Text size="sm" class="text-muted-foreground">
      {extras.bio}
    </Text>
  {/if}
</Stack>

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add post-author
components/post-author.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line,
 * a card, or a card with the bio.
 */
import { type ReactNode } from "react";
import { Box, Button, Group, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { cn } from "../utils";
import type { Post } from "../blocks/post-card.types";
import type { PostExtras, PostSplitLabels } from "../blocks/post-split.types";

export type PostAuthorProps = {
  post: Post;
  extras: PostExtras;
  labels: PostSplitLabels;
  mode?: "line" | "card" | "bio";
  share?: boolean;
  className?: string;
};

export function PostAuthor({
  post,
  extras,
  labels,
  mode = "line",
  share = false,
  className,
}: PostAuthorProps) {
  return (
    <Stack
      gap="4"
      align="stretch"
      className={cn(
        (((mode as string) === "line") ? "" : "rounded bg-card inset-ring inset-ring-border p-4"),
        className
      )}
      data-slot="post-author"
    >
      <Group gap="4" align="center">
        <MediaFrame alt={post.author} ratio="1/1" className="size-10 shrink-0 rounded-full" />
        <Stack gap="0" align="start" className="min-w-0 flex-1 text-start">
          <Text size="sm" weight="semibold">
            {post.author}
          </Text>
          <Text size="xs" className="text-muted-foreground">
            {extras.role}
          </Text>
        </Stack>
        {share ? (
          <Group gap="2">
            <Button variant="ghost" size="default" className="gap-2">
              <LucideIcon name="share-2" size={16} />
              {labels.share}
            </Button>
            <Button variant="ghost" size="default" className="gap-2">
              <LucideIcon name="bookmark" size={16} />
              {labels.save}
            </Button>
          </Group>
        ) : (
          <Box className="text-muted-foreground">
            <Group gap="2" align="center">
              <LucideIcon name="calendar" size={16} />
              <Text size="sm">
                {post.date}
              </Text>
            </Group>
          </Box>
        )}
      </Group>
      {((mode as string) === "bio") ? (
        <Text size="sm" className="text-muted-foreground">
          {extras.bio}
        </Text>
      ) : null}
    </Stack>
  );
}

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add post-author
components/post-author.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line,
  a card, or a card with the bio.
-->
<script lang="ts">
import type { Post } from "../blocks/post-card.types";
import type { PostExtras, PostSplitLabels } from "../blocks/post-split.types";

export type PostAuthorProps = {
  post: Post;
  extras: PostExtras;
  labels: PostSplitLabels;
  mode?: "line" | "card" | "bio";
  share?: boolean;
  class?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Button from "../compose/Button.vue";
import Group from "../compose/Group.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import MediaFrame from "../components/media-frame.vue";
import { cn } from "../utils";

const {
  post,
  extras,
  labels,
  mode = "line",
  share = false,
  class: className,
} = defineProps<PostAuthorProps>();
</script>

<template>
  <Stack
    gap="4"
    align="stretch"
    :class="cn(
      (((mode as string) === 'line') ? '' : 'rounded bg-card inset-ring inset-ring-border p-4'),
      className
    )"
    data-slot="post-author"
  >
    <Group gap="4" align="center">
      <MediaFrame :alt="post.author" ratio="1/1" class="size-10 shrink-0 rounded-full" />
      <Stack gap="0" align="start" class="min-w-0 flex-1 text-start">
        <Text size="sm" weight="semibold">
          {{ post.author }}
        </Text>
        <Text size="xs" class="text-muted-foreground">
          {{ extras.role }}
        </Text>
      </Stack>
      <Group v-if="share" gap="2">
        <Button variant="ghost" size="default" class="gap-2">
          <LucideIcon name="share-2" :size="16" />
          {{ labels.share }}
        </Button>
        <Button variant="ghost" size="default" class="gap-2">
          <LucideIcon name="bookmark" :size="16" />
          {{ labels.save }}
        </Button>
      </Group>
      <Box v-else class="text-muted-foreground">
        <Group gap="2" align="center">
          <LucideIcon name="calendar" :size="16" />
          <Text size="sm">
            {{ post.date }}
          </Text>
        </Group>
      </Box>
    </Group>
    <Text v-if="((mode as string) === 'bio')" size="sm" class="text-muted-foreground">
      {{ extras.bio }}
    </Text>
  </Stack>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add post-author
components/post-author.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line,
 * a card, or a card with the bio.
 */
import { type JSX } from "solid-js";
import { Box, Button, Group, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { cn } from "../utils";
import type { Post } from "../blocks/post-card.types";
import type { PostExtras, PostSplitLabels } from "../blocks/post-split.types";

export type PostAuthorProps = {
  post: Post;
  extras: PostExtras;
  labels: PostSplitLabels;
  mode?: "line" | "card" | "bio";
  share?: boolean;
  class?: string;
};

export function PostAuthor({
  post,
  extras,
  labels,
  mode = "line",
  share = false,
  class: className,
}: PostAuthorProps) {
  return (
    <Stack
      gap="4"
      align="stretch"
      class={cn(
        (((mode as string) === "line") ? "" : "rounded bg-card inset-ring inset-ring-border p-4"),
        className
      )}
      data-slot="post-author"
    >
      <Group gap="4" align="center">
        <MediaFrame alt={post.author} ratio="1/1" class="size-10 shrink-0 rounded-full" />
        <Stack gap="0" align="start" class="min-w-0 flex-1 text-start">
          <Text size="sm" weight="semibold">
            {post.author}
          </Text>
          <Text size="xs" class="text-muted-foreground">
            {extras.role}
          </Text>
        </Stack>
        {share ? (
          <Group gap="2">
            <Button variant="ghost" size="default" class="gap-2">
              <LucideIcon name="share-2" size={16} />
              {labels.share}
            </Button>
            <Button variant="ghost" size="default" class="gap-2">
              <LucideIcon name="bookmark" size={16} />
              {labels.save}
            </Button>
          </Group>
        ) : (
          <Box class="text-muted-foreground">
            <Group gap="2" align="center">
              <LucideIcon name="calendar" size={16} />
              <Text size="sm">
                {post.date}
              </Text>
            </Group>
          </Box>
        )}
      </Group>
      {((mode as string) === "bio") ? (
        <Text size="sm" class="text-muted-foreground">
          {extras.bio}
        </Text>
      ) : null}
    </Stack>
  );
}

Solid registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add post-author
blocks/post-author.templ
// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/post-author.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/ui/button"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/icons"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// PostAuthorProps are the props of PostAuthor; the values are the JSON shapes of the TypeScript props.
type PostAuthorProps struct {
	Post any `json:"post"`
	Extras any `json:"extras"`
	Labels any `json:"labels"`
	Mode any `json:"mode"`
	Share any `json:"share"`
	Class string `json:"className"`
}

// The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line, a card, or a card with the bio.
templ PostAuthor(p PostAuthorProps) {
	{{ vPost := p.Post }}
	{{ vExtras := p.Extras }}
	{{ vLabels := p.Labels }}
	{{ vMode := uiutils.Def(p.Mode, "line") }}
	{{ vShare := uiutils.Def(p.Share, false) }}
	@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv(uiutils.Cond(uiutils.T(uiutils.Eq(vMode, "line")), "", "rounded bg-card inset-ring inset-ring-border p-4"), p.Class)), Attrs: uiutils.Attrs("data-slot", "post-author")}}) {
		@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{}}) {
			@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vPost, "author"), Ratio: "1/1", Class: uiutils.Cnv("size-10 shrink-0 rounded-full")})
			@compose.Stack(compose.StackProps{Gap: "0", Align: "start", BoxProps: box.BoxProps{Class: "min-w-0 flex-1 text-start"}}) {
				@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
					{ uiutils.Text(uiutils.Get(vPost, "author")) }
				}
				@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
					{ uiutils.Text(uiutils.Get(vExtras, "role")) }
				}
			}
			if uiutils.T(vShare) {
				@compose.Group(compose.GroupProps{Gap: "2", BoxProps: box.BoxProps{}}) {
					@compose.Button(compose.ButtonProps{Variant: "ghost", Size: "default", ButtonProps: button.ButtonProps{Class: "gap-2"}}) {
						@icons.LucideIcon(icons.LucideIconProps{Name: "share-2", Size: 16})
						{ uiutils.Text(uiutils.Get(vLabels, "share")) }
					}
					@compose.Button(compose.ButtonProps{Variant: "ghost", Size: "default", ButtonProps: button.ButtonProps{Class: "gap-2"}}) {
						@icons.LucideIcon(icons.LucideIconProps{Name: "bookmark", Size: 16})
						{ uiutils.Text(uiutils.Get(vLabels, "save")) }
					}
				}
			} else {
				@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "text-muted-foreground"}}) {
					@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{}}) {
						@icons.LucideIcon(icons.LucideIconProps{Name: "calendar", Size: 16})
						@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{}}) {
							{ uiutils.Text(uiutils.Get(vPost, "date")) }
						}
					}
				}
			}
		}
		if uiutils.Eq(vMode, "bio") {
			@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
				{ uiutils.Text(uiutils.Get(vExtras, "bio")) }
			}
		}
	}
}

templ registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdn
npx ui8kit add post-author
blocks/post-author.html.twig
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-author.json
    The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line, a card, or a card with the bio.
    Props (p): post, extras, labels, mode, share, className. -#}
{%- set v_post = (p.post ?? null) -%}
{%- set v_extras = (p.extras ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_mode = (p.mode ?? 'line') -%}
{%- set v_share = (p.share ?? false) -%}
{%- set c_12 -%}
  {%- set c_10 -%}
    {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_post, ['author']), 'ratio': '1/1', 'className': og_cnv(['size-10 shrink-0 rounded-full'])}}, with_context = false) }}
    {%- set c_3 -%}
      {%- set c_1 -%}
        {{ og_text(og_get(v_post, ['author'])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
      {%- set c_2 -%}
        {{ og_text(og_get(v_extras, ['role'])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Stack.html.twig', {'gap': '0', 'align': 'start', 'class': 'min-w-0 flex-1 text-start', 'children': c_3}, with_context = false) }}
    {%- if og_t(v_share) %}
      {%- set c_6 -%}
        {%- set c_4 -%}
          {{ include('icons/LucideIcon.html.twig', {'name': 'share-2', 'size': 16}, with_context = false) }}
          {{ og_text(og_get(v_labels, ['share'])) }}
        {%- endset -%}
        {{ include('compose/Button.html.twig', {'variant': 'ghost', 'size': 'default', 'class': 'gap-2', 'children': c_4}, with_context = false) }}
        {%- set c_5 -%}
          {{ include('icons/LucideIcon.html.twig', {'name': 'bookmark', 'size': 16}, with_context = false) }}
          {{ og_text(og_get(v_labels, ['save'])) }}
        {%- endset -%}
        {{ include('compose/Button.html.twig', {'variant': 'ghost', 'size': 'default', 'class': 'gap-2', 'children': c_5}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Group.html.twig', {'gap': '2', 'children': c_6}, with_context = false) }}
    {%- else %}
      {%- set c_9 -%}
        {%- set c_8 -%}
          {{ include('icons/LucideIcon.html.twig', {'name': 'calendar', 'size': 16}, with_context = false) }}
          {%- set c_7 -%}
            {{ og_text(og_get(v_post, ['date'])) }}
          {%- endset -%}
          {{ include('compose/Text.html.twig', {'size': 'sm', 'children': c_7}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'children': c_8}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Box.html.twig', {'class': 'text-muted-foreground', 'children': c_9}, with_context = false) }}
    {%- endif %}
  {%- endset -%}
  {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'children': c_10}, with_context = false) }}
  {%- if og_t(og_eq(v_mode, 'bio')) %}
    {%- set c_11 -%}
      {{ og_text(og_get(v_extras, ['bio'])) }}
    {%- endset -%}
    {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_11}, with_context = false) }}
  {%- endif %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'class': og_s(og_cnv([(og_t(og_eq(v_mode, 'line')) ? '' : 'rounded bg-card inset-ring inset-ring-border p-4'), (p.className ?? '')])), 'attrs': og_attrs(['data-slot', 'post-author']), 'children': c_12}, with_context = false) }}

Twig registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdn
npx ui8kit add post-author
blocks/post-author.latte
{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-author.json
    The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line, a card, or a card with the bio.
    Props (p): post, extras, labels, mode, share, className. *}
{var $v_post = ($p['post'] ?? null)}
{var $v_extras = ($p['extras'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_mode = ($p['mode'] ?? 'line')}
{var $v_share = ($p['share'] ?? false)}
{capture $c_12}
  {capture $c_10}
    {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_post, ['author']), 'ratio' => '1/1', 'className' => og_cnv(['size-10 shrink-0 rounded-full'])]])|noescape}
    {capture $c_3}
      {capture $c_1}
        {=og_text(og_get($v_post, ['author']))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
      {capture $c_2}
        {=og_text(og_get($v_extras, ['role']))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
    {/capture}
    {=og_include('compose/Stack.latte', ['gap' => '0', 'align' => 'start', 'class' => 'min-w-0 flex-1 text-start', 'children' => (string) $c_3])|noescape}
    {if og_t($v_share)}
      {capture $c_6}
        {capture $c_4}
          {=og_include('icons/LucideIcon.latte', ['name' => 'share-2', 'size' => 16])|noescape}
          {=og_text(og_get($v_labels, ['share']))}
        {/capture}
        {=og_include('compose/Button.latte', ['variant' => 'ghost', 'size' => 'default', 'class' => 'gap-2', 'children' => (string) $c_4])|noescape}
        {capture $c_5}
          {=og_include('icons/LucideIcon.latte', ['name' => 'bookmark', 'size' => 16])|noescape}
          {=og_text(og_get($v_labels, ['save']))}
        {/capture}
        {=og_include('compose/Button.latte', ['variant' => 'ghost', 'size' => 'default', 'class' => 'gap-2', 'children' => (string) $c_5])|noescape}
      {/capture}
      {=og_include('compose/Group.latte', ['gap' => '2', 'children' => (string) $c_6])|noescape}
    {else}
      {capture $c_9}
        {capture $c_8}
          {=og_include('icons/LucideIcon.latte', ['name' => 'calendar', 'size' => 16])|noescape}
          {capture $c_7}
            {=og_text(og_get($v_post, ['date']))}
          {/capture}
          {=og_include('compose/Text.latte', ['size' => 'sm', 'children' => (string) $c_7])|noescape}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'children' => (string) $c_8])|noescape}
      {/capture}
      {=og_include('compose/Box.latte', ['class' => 'text-muted-foreground', 'children' => (string) $c_9])|noescape}
    {/if}
  {/capture}
  {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'children' => (string) $c_10])|noescape}
  {if og_t(og_eq($v_mode, 'bio'))}
    {capture $c_11}
      {=og_text(og_get($v_extras, ['bio']))}
    {/capture}
    {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_11])|noescape}
  {/if}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'class' => og_s(og_cnv([(og_t(og_eq($v_mode, 'line')) ? '' : 'rounded bg-card inset-ring inset-ring-border p-4'), ($p['className'] ?? '')])), 'attrs' => og_attrs(['data-slot', 'post-author']), 'children' => (string) $c_12])|noescape}

Latte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdn
npx ui8kit add post-author
blocks/post-author.html.j2
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/post-author.json
    The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line, a card, or a card with the bio.
    Props (p): post, extras, labels, mode, share, className. -#}
{%- set v_post = og_def(p['post'], none) -%}
{%- set v_extras = og_def(p['extras'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_mode = og_def(p['mode'], 'line') -%}
{%- set v_share = og_def(p['share'], false) -%}
{%- set c_12 -%}
  {%- set c_10 -%}
    {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_post, ['author']), 'ratio': '1/1', 'className': og_cnv(['size-10 shrink-0 rounded-full'])}}) }}
    {%- set c_3 -%}
      {%- set c_1 -%}
        {{ og_text(og_get(v_post, ['author'])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
      {%- set c_2 -%}
        {{ og_text(og_get(v_extras, ['role'])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
    {%- endset -%}
    {{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Align': 'start', 'Class': 'min-w-0 flex-1 text-start'}, 'children': c_3}) }}
    {%- if og_t(v_share) %}
      {%- set c_6 -%}
        {%- set c_4 -%}
          {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'share-2', 'Size': 16}}) }}
          {{ og_text(og_get(v_labels, ['share'])) }}
        {%- endset -%}
        {{ og_include('compose/button.html.j2', {'p': {'Variant': 'ghost', 'Size': 'default', 'Class': 'gap-2'}, 'children': c_4}) }}
        {%- set c_5 -%}
          {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'bookmark', 'Size': 16}}) }}
          {{ og_text(og_get(v_labels, ['save'])) }}
        {%- endset -%}
        {{ og_include('compose/button.html.j2', {'p': {'Variant': 'ghost', 'Size': 'default', 'Class': 'gap-2'}, 'children': c_5}) }}
      {%- endset -%}
      {{ og_include('compose/group.html.j2', {'p': {'Gap': '2'}, 'children': c_6}) }}
    {%- else %}
      {%- set c_9 -%}
        {%- set c_8 -%}
          {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'calendar', 'Size': 16}}) }}
          {%- set c_7 -%}
            {{ og_text(og_get(v_post, ['date'])) }}
          {%- endset -%}
          {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm'}, 'children': c_7}) }}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center'}, 'children': c_8}) }}
      {%- endset -%}
      {{ og_include('compose/box.html.j2', {'p': {'Class': 'text-muted-foreground'}, 'children': c_9}) }}
    {%- endif %}
  {%- endset -%}
  {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center'}, 'children': c_10}) }}
  {%- if og_t(og_eq(v_mode, 'bio')) %}
    {%- set c_11 -%}
      {{ og_text(og_get(v_extras, ['bio'])) }}
    {%- endset -%}
    {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_11}) }}
  {%- endif %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Class': og_s(og_cnv([('' if og_t(og_eq(v_mode, 'line')) else 'rounded bg-card inset-ring inset-ring-border p-4'), og_def(p['className'], '')])), 'Attrs': og_attrs(['data-slot', 'post-author'])}, 'children': c_12}) }}

Jinja2 registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

The author of a post: the portrait, the name and role, and the date or the share and save buttons; as a line, a card, or a card with the bio.

Props of PostAuthor
PropTypeDefault Description
post (required)Post-
extras (required)PostExtras-the author's role and bio, the reading figures, the tags and the outline
labels (required)PostSplitLabels-
mode "line" | "card" | "bio""line"
share booleanfalseshare and save buttons instead of the date

Used in