2026-03-14 00:39:59 +00:00
|
|
|
import Feather from "@expo/vector-icons/Feather"
|
feat(client): add component library and simplify routing (#66)
* feat(client): add component library and simplify routing
Remove tab layout, explore page, modal, and unused template
components. Replace with single-page layout and a dev component
showcase with per-component detail pages.
- Add Button with label prop, leading/trailing icon support
- Add FeedCard, SerifText, SansSerifText, MonospaceText
- Add colocated *.showcase.tsx files for each component
- Use Stack navigator with themed headers
Co-authored-by: Ona <no-reply@ona.com>
* fix(client): render showcase as JSX component
Co-authored-by: Ona <no-reply@ona.com>
* chore(client): remove dead code chain
Remove ThemedText, useThemeColor, useColorScheme hook,
Colors, and Fonts — none referenced by current screens.
Co-authored-by: Ona <no-reply@ona.com>
---------
Co-authored-by: Ona <no-reply@ona.com>
2026-03-13 00:23:06 +00:00
|
|
|
import { type PressableProps, Pressable, View } from "react-native"
|
|
|
|
|
import tw from "twrnc"
|
|
|
|
|
|
|
|
|
|
import { SansSerifText } from "./sans-serif-text"
|
|
|
|
|
|
2026-03-14 00:39:59 +00:00
|
|
|
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")} />
|
|
|
|
|
}
|
|
|
|
|
|
feat(client): add component library and simplify routing (#66)
* feat(client): add component library and simplify routing
Remove tab layout, explore page, modal, and unused template
components. Replace with single-page layout and a dev component
showcase with per-component detail pages.
- Add Button with label prop, leading/trailing icon support
- Add FeedCard, SerifText, SansSerifText, MonospaceText
- Add colocated *.showcase.tsx files for each component
- Use Stack navigator with themed headers
Co-authored-by: Ona <no-reply@ona.com>
* fix(client): render showcase as JSX component
Co-authored-by: Ona <no-reply@ona.com>
* chore(client): remove dead code chain
Remove ThemedText, useThemeColor, useColorScheme hook,
Colors, and Fonts — none referenced by current screens.
Co-authored-by: Ona <no-reply@ona.com>
---------
Co-authored-by: Ona <no-reply@ona.com>
2026-03-13 00:23:06 +00:00
|
|
|
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
|
|
|
|
|
|
2026-03-14 00:39:59 +00:00
|
|
|
const textElement = <SansSerifText style={tw`text-stone-100 dark:text-stone-200 font-medium`}>{label}</SansSerifText>
|
feat(client): add component library and simplify routing (#66)
* feat(client): add component library and simplify routing
Remove tab layout, explore page, modal, and unused template
components. Replace with single-page layout and a dev component
showcase with per-component detail pages.
- Add Button with label prop, leading/trailing icon support
- Add FeedCard, SerifText, SansSerifText, MonospaceText
- Add colocated *.showcase.tsx files for each component
- Use Stack navigator with themed headers
Co-authored-by: Ona <no-reply@ona.com>
* fix(client): render showcase as JSX component
Co-authored-by: Ona <no-reply@ona.com>
* chore(client): remove dead code chain
Remove ThemedText, useThemeColor, useColorScheme hook,
Colors, and Fonts — none referenced by current screens.
Co-authored-by: Ona <no-reply@ona.com>
---------
Co-authored-by: Ona <no-reply@ona.com>
2026-03-13 00:23:06 +00:00
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
)
|
|
|
|
|
}
|
2026-03-14 00:39:59 +00:00
|
|
|
|
|
|
|
|
Button.Icon = ButtonIcon
|