mirror of
https://github.com/kennethnym/aris.git
synced 2026-06-17 21:11:17 +01:00
chore: rename aelis to freya (#122)
This commit is contained in:
18
apps/freya-client/src/components/showcase.tsx
Normal file
18
apps/freya-client/src/components/showcase.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import { View } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
import { SansSerifText } from "./ui/sans-serif-text"
|
||||
|
||||
export type Showcase = {
|
||||
title: string
|
||||
component: React.ComponentType
|
||||
}
|
||||
|
||||
export function Section({ title, children }: { title: string; children: React.ReactNode }) {
|
||||
return (
|
||||
<View style={tw`gap-3`}>
|
||||
<SansSerifText style={tw`text-sm text-stone-500 dark:text-stone-400`}>{title}</SansSerifText>
|
||||
{children}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
38
apps/freya-client/src/components/ui/button.showcase.tsx
Normal file
38
apps/freya-client/src/components/ui/button.showcase.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import { View } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
import { type Showcase, Section } from "../showcase"
|
||||
import { Button } from "./button"
|
||||
|
||||
function ButtonShowcase() {
|
||||
return (
|
||||
<View style={tw`gap-6`}>
|
||||
<Section title="Default">
|
||||
<Button style={tw`self-start`} label="Press me" />
|
||||
</Section>
|
||||
<Section title="Leading icon">
|
||||
<Button style={tw`self-start`} label="Add item" leadingIcon={<Button.Icon name="plus" />} />
|
||||
</Section>
|
||||
<Section title="Trailing icon">
|
||||
<Button
|
||||
style={tw`self-start`}
|
||||
label="Next"
|
||||
trailingIcon={<Button.Icon name="arrow-right" />}
|
||||
/>
|
||||
</Section>
|
||||
<Section title="Both icons">
|
||||
<Button
|
||||
style={tw`self-start`}
|
||||
label="Download"
|
||||
leadingIcon={<Button.Icon name="download" />}
|
||||
trailingIcon={<Button.Icon name="chevron-down" />}
|
||||
/>
|
||||
</Section>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export const buttonShowcase: Showcase = {
|
||||
title: "Button",
|
||||
component: ButtonShowcase,
|
||||
}
|
||||
47
apps/freya-client/src/components/ui/button.tsx
Normal file
47
apps/freya-client/src/components/ui/button.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
import Feather from "@expo/vector-icons/Feather"
|
||||
import { type PressableProps, Pressable, View } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
import { SansSerifText } from "./sans-serif-text"
|
||||
|
||||
type FeatherIconName = React.ComponentProps<typeof Feather>["name"]
|
||||
|
||||
type ButtonIconProps = {
|
||||
name: FeatherIconName
|
||||
}
|
||||
|
||||
function ButtonIcon({ name }: ButtonIconProps) {
|
||||
return <Feather name={name} size={18} color={tw.color("text-stone-100 dark:text-stone-200")} />
|
||||
}
|
||||
|
||||
type ButtonProps = Omit<PressableProps, "children"> & {
|
||||
label: string
|
||||
leadingIcon?: React.ReactNode
|
||||
trailingIcon?: React.ReactNode
|
||||
}
|
||||
|
||||
export function Button({ style, label, leadingIcon, trailingIcon, ...props }: ButtonProps) {
|
||||
const hasIcons = leadingIcon != null || trailingIcon != null
|
||||
|
||||
const textElement = (
|
||||
<SansSerifText style={tw`text-stone-100 dark:text-stone-200 font-medium`}>
|
||||
{label}
|
||||
</SansSerifText>
|
||||
)
|
||||
|
||||
return (
|
||||
<Pressable style={[tw`rounded-full bg-teal-600 px-4 py-3 w-fit`, style]} {...props}>
|
||||
{hasIcons ? (
|
||||
<View style={tw`flex-row items-center gap-1.5`}>
|
||||
{leadingIcon}
|
||||
{textElement}
|
||||
{trailingIcon}
|
||||
</View>
|
||||
) : (
|
||||
textElement
|
||||
)}
|
||||
</Pressable>
|
||||
)
|
||||
}
|
||||
|
||||
Button.Icon = ButtonIcon
|
||||
32
apps/freya-client/src/components/ui/feed-card.showcase.tsx
Normal file
32
apps/freya-client/src/components/ui/feed-card.showcase.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { View } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
import { type Showcase, Section } from "../showcase"
|
||||
import { Button } from "./button"
|
||||
import { FeedCard } from "./feed-card"
|
||||
import { SansSerifText } from "./sans-serif-text"
|
||||
import { SerifText } from "./serif-text"
|
||||
|
||||
function FeedCardShowcase() {
|
||||
return (
|
||||
<View style={tw`gap-6`}>
|
||||
<Section title="Default">
|
||||
<FeedCard style={tw`p-4`}>
|
||||
<SansSerifText>Card content goes here</SansSerifText>
|
||||
</FeedCard>
|
||||
</Section>
|
||||
<Section title="With mixed content">
|
||||
<FeedCard style={tw`p-4 gap-2`}>
|
||||
<SerifText style={tw`text-xl`}>Title</SerifText>
|
||||
<SansSerifText>Body text inside a feed card.</SansSerifText>
|
||||
<Button style={tw`self-start mt-2`} label="Action" />
|
||||
</FeedCard>
|
||||
</Section>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export const feedCardShowcase: Showcase = {
|
||||
title: "FeedCard",
|
||||
component: FeedCardShowcase,
|
||||
}
|
||||
11
apps/freya-client/src/components/ui/feed-card.tsx
Normal file
11
apps/freya-client/src/components/ui/feed-card.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { View, type ViewProps } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
export function FeedCard({ style, ...props }: ViewProps) {
|
||||
return (
|
||||
<View
|
||||
style={[tw`border border-stone-200 dark:border-stone-800 rounded-lg`, style]}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { View } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
import { type Showcase, Section } from "../showcase"
|
||||
import { MonospaceText } from "./monospace-text"
|
||||
|
||||
function MonospaceTextShowcase() {
|
||||
return (
|
||||
<View style={tw`gap-6`}>
|
||||
<Section title="Sizes">
|
||||
<View style={tw`gap-2`}>
|
||||
<MonospaceText style={tw`text-sm`}>Small monospace text</MonospaceText>
|
||||
<MonospaceText style={tw`text-base`}>Base monospace text</MonospaceText>
|
||||
<MonospaceText style={tw`text-xl`}>Extra large monospace text</MonospaceText>
|
||||
<MonospaceText style={tw`text-3xl`}>3XL monospace text</MonospaceText>
|
||||
</View>
|
||||
</Section>
|
||||
<Section title="Code-like usage">
|
||||
<View style={tw`bg-stone-200 dark:bg-stone-800 rounded-lg p-3`}>
|
||||
<MonospaceText style={tw`text-sm`}>{"const x = 42;"}</MonospaceText>
|
||||
<MonospaceText style={tw`text-sm`}>{"console.log(x);"}</MonospaceText>
|
||||
</View>
|
||||
</Section>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export const monospaceTextShowcase: Showcase = {
|
||||
title: "MonospaceText",
|
||||
component: MonospaceTextShowcase,
|
||||
}
|
||||
13
apps/freya-client/src/components/ui/monospace-text.tsx
Normal file
13
apps/freya-client/src/components/ui/monospace-text.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Text, type TextProps } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
export function MonospaceText({ children, style, ...props }: TextProps) {
|
||||
return (
|
||||
<Text
|
||||
style={[tw`text-stone-800 dark:text-stone-200`, { fontFamily: "Menlo" }, style]}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import { View } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
import { type Showcase, Section } from "../showcase"
|
||||
import { SansSerifText } from "./sans-serif-text"
|
||||
|
||||
function SansSerifTextShowcase() {
|
||||
return (
|
||||
<View style={tw`gap-6`}>
|
||||
<Section title="Sizes">
|
||||
<View style={tw`gap-2`}>
|
||||
<SansSerifText style={tw`text-sm`}>Small sans-serif text</SansSerifText>
|
||||
<SansSerifText style={tw`text-base`}>Base sans-serif text</SansSerifText>
|
||||
<SansSerifText style={tw`text-xl`}>Extra large sans-serif text</SansSerifText>
|
||||
<SansSerifText style={tw`text-3xl`}>3XL sans-serif text</SansSerifText>
|
||||
</View>
|
||||
</Section>
|
||||
<Section title="Weights">
|
||||
<View style={tw`gap-2`}>
|
||||
<SansSerifText style={tw`font-light`}>Light weight</SansSerifText>
|
||||
<SansSerifText style={tw`font-normal`}>Normal weight</SansSerifText>
|
||||
<SansSerifText style={tw`font-medium`}>Medium weight</SansSerifText>
|
||||
<SansSerifText style={tw`font-semibold`}>Semibold weight</SansSerifText>
|
||||
<SansSerifText style={tw`font-bold`}>Bold weight</SansSerifText>
|
||||
</View>
|
||||
</Section>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export const sansSerifTextShowcase: Showcase = {
|
||||
title: "SansSerifText",
|
||||
component: SansSerifTextShowcase,
|
||||
}
|
||||
13
apps/freya-client/src/components/ui/sans-serif-text.tsx
Normal file
13
apps/freya-client/src/components/ui/sans-serif-text.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Text, type TextProps } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
export function SansSerifText({ children, style, ...props }: TextProps) {
|
||||
return (
|
||||
<Text
|
||||
style={[tw`text-stone-800 dark:text-stone-200`, { fontFamily: "Inter" }, style]}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
25
apps/freya-client/src/components/ui/serif-text.showcase.tsx
Normal file
25
apps/freya-client/src/components/ui/serif-text.showcase.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { View } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
import { type Showcase, Section } from "../showcase"
|
||||
import { SerifText } from "./serif-text"
|
||||
|
||||
function SerifTextShowcase() {
|
||||
return (
|
||||
<View style={tw`gap-6`}>
|
||||
<Section title="Sizes">
|
||||
<View style={tw`gap-2`}>
|
||||
<SerifText style={tw`text-sm`}>Small serif text</SerifText>
|
||||
<SerifText style={tw`text-base`}>Base serif text</SerifText>
|
||||
<SerifText style={tw`text-xl`}>Extra large serif text</SerifText>
|
||||
<SerifText style={tw`text-3xl`}>3XL serif text</SerifText>
|
||||
</View>
|
||||
</Section>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
export const serifTextShowcase: Showcase = {
|
||||
title: "SerifText",
|
||||
component: SerifTextShowcase,
|
||||
}
|
||||
13
apps/freya-client/src/components/ui/serif-text.tsx
Normal file
13
apps/freya-client/src/components/ui/serif-text.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Text, type TextProps } from "react-native"
|
||||
import tw from "twrnc"
|
||||
|
||||
export function SerifText({ children, style, ...props }: TextProps) {
|
||||
return (
|
||||
<Text
|
||||
style={[tw`text-stone-800 dark:text-stone-200`, { fontFamily: "Source Serif 4" }, style]}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user