Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use popicons 🎈 #221

Merged
merged 3 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions components/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LucideIcon } from "lucide-react-native";
import { View } from "react-native";
import { SvgProps } from "react-native-svg";
import {
Card,
CardContent,
Expand All @@ -10,7 +10,7 @@ import { cn } from "~/lib/utils";

type Props = {
type: "error" | "warn" | "info";
icon: LucideIcon;
icon: React.FunctionComponent<SvgProps>;
title: string;
description: string;
className?: string;
Expand All @@ -37,7 +37,7 @@ function Alert({ title, description, type, icon: Icon, className }: Props) {
)}
>
<CardContent className="flex flex-row items-center gap-4">
<Icon className={textColor} />
<Icon className={textColor} width={24} height={24} />
<View className="flex flex-1 flex-col">
<CardTitle className={textColor}>{title}</CardTitle>
<CardDescription className={textColor}>{description}</CardDescription>
Expand Down
4 changes: 2 additions & 2 deletions components/DualCurrencyInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { StyleSheet, TouchableOpacity, View } from "react-native";
import { SwapIcon } from "~/components/Icons";
import { useGetFiatAmount, useGetSatsAmount } from "~/hooks/useGetFiatAmount";
import {
CURSOR_COLOR,
Expand All @@ -9,7 +10,6 @@ import {
} from "~/lib/constants";
import { useAppStore } from "~/lib/state/appStore";
import { cn } from "~/lib/utils";
import { RefreshCw } from "./Icons";
import { Input } from "./ui/input";
import { Text } from "./ui/text";

Expand Down Expand Up @@ -88,7 +88,7 @@ export function DualCurrencyInput({
<Text className="font-semibold2 text-2xl text-muted-foreground">
{inputMode === "fiat" ? fiatCurrency : "sats"}
</Text>
<RefreshCw className="text-muted-foreground" width={16} height={16} />
<SwapIcon className="text-muted-foreground" width={16} height={16} />
</View>
</TouchableOpacity>
{
Expand Down
213 changes: 87 additions & 126 deletions components/Icons.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,38 @@
import {
AlertCircle,
ArchiveRestore,
ArrowDown,
ArrowLeftRight,
Bitcoin,
BookUser,
Camera,
CameraOff,
CheckCircle,
ChevronDown,
ChevronUp,
CircleCheck,
ClipboardPaste,
Cog,
Copy,
Currency,
Egg,
Fingerprint,
HelpCircle,
Hotel,
Keyboard,
LogOut,
LucideIcon,
Menu,
MoveDown,
MoveDownLeft,
MoveDownRight,
MoveUp,
MoveUpRight,
Palette,
PlusCircle,
Power,
RefreshCw,
Settings2,
Share2,
Trash2,
TriangleAlert,
UserCircle2,
Wallet2,
WalletIcon,
X,
XCircle,
ZapIcon,
} from "lucide-react-native";
PopiconsCircleExclamationLine as AlertCircleIcon,
PopiconsBitcoinSolid as BitcoinIcon,
PopiconsAddressBookSolid as BookUserIcon,
PopiconsCameraWebOffSolid as CameraOffIcon,
PopiconsCircleCheckLine as CheckCircleIcon,
PopiconsChevronTopLine as ChevronUpIcon,
PopiconsCopySolid as CopyIcon,
PopiconsEditSolid as EditIcon,
PopiconsUploadSolid as ExportIcon,
PopiconsTouchIdSolid as FingerprintIcon,
PopiconsCircleInfoLine as HelpCircleIcon,
PopiconsArrowDownLine as MoveDownIcon,
PopiconsArrowUpLine as MoveUpIcon,
PopiconsLifebuoySolid as OnboardingIcon,
PopiconsClipboardTextSolid as PasteIcon,
PopiconsReloadLine as RefreshIcon,
PopiconsReloadSolid as ResetIcon,
PopiconsSettingsMinimalLine as SettingsIcon,
PopiconsShareSolid as ShareIcon,
PopiconsLogoutSolid as SignOutIcon,
PopiconsLoopSolid as SwapIcon,
PopiconsPaintSolid as ThemeIcon,
PopiconsBinSolid as TrashIcon,
PopiconsTriangleExclamationLine as TriangleAlertIcon,
PopiconsWalletHorizontalOpenSolid as WalletIcon,
PopiconsDownloadSolid as WithdrawIcon,
PopiconsCircleXLine as XCircleIcon,
PopiconsXSolid as XIcon,
PopiconsBoltSolid as ZapIcon,
} from "@popicons/react-native";
import { cssInterop } from "nativewind";
import { SvgProps } from "react-native-svg";

function interopIcon(icon: LucideIcon) {
function interopIcon(icon: React.FunctionComponent<SvgProps>) {
cssInterop(icon, {
className: {
target: "style",
Expand All @@ -57,90 +44,64 @@ function interopIcon(icon: LucideIcon) {
});
}

interopIcon(AlertCircle);
interopIcon(ArrowDown);
interopIcon(CheckCircle);
interopIcon(Bitcoin);
interopIcon(XCircle);
interopIcon(MoveUp);
interopIcon(MoveDown);
interopIcon(ChevronDown);
interopIcon(ChevronUp);
interopIcon(MoveDownRight);
interopIcon(MoveUpRight);
interopIcon(MoveDownLeft);
interopIcon(Camera);
interopIcon(Menu);
interopIcon(ZapIcon);
interopIcon(AlertCircleIcon);
interopIcon(BitcoinIcon);
interopIcon(BookUserIcon);
interopIcon(CameraOffIcon);
interopIcon(CheckCircleIcon);
interopIcon(ChevronUpIcon);
interopIcon(CopyIcon);
interopIcon(EditIcon);
interopIcon(ExportIcon);
interopIcon(FingerprintIcon);
interopIcon(HelpCircleIcon);
interopIcon(MoveDownIcon);
interopIcon(MoveUpIcon);
interopIcon(OnboardingIcon);
interopIcon(PasteIcon);
interopIcon(RefreshIcon);
interopIcon(ResetIcon);
interopIcon(SettingsIcon);
interopIcon(ShareIcon);
interopIcon(SignOutIcon);
interopIcon(SwapIcon);
interopIcon(ThemeIcon);
interopIcon(TrashIcon);
interopIcon(TriangleAlertIcon);
interopIcon(WalletIcon);
interopIcon(Copy);
interopIcon(Currency);
interopIcon(Settings2);
interopIcon(ArrowLeftRight);
interopIcon(PlusCircle);
interopIcon(Cog);
interopIcon(ClipboardPaste);
interopIcon(Keyboard);
interopIcon(BookUser);
interopIcon(Wallet2);
interopIcon(Share2);
interopIcon(RefreshCw);
interopIcon(X);
interopIcon(Hotel);
interopIcon(Power);
interopIcon(CameraOff);
interopIcon(Palette);
interopIcon(Egg);
interopIcon(Fingerprint);
interopIcon(HelpCircle);
interopIcon(CircleCheck);
interopIcon(TriangleAlert);
interopIcon(LogOut);
interopIcon(ArchiveRestore);
interopIcon(UserCircle2);
interopIcon(Trash2);
interopIcon(WithdrawIcon);
interopIcon(XCircleIcon);
interopIcon(XIcon);
interopIcon(ZapIcon);

export {
AlertCircle,
ArchiveRestore,
ArrowDown,
ArrowLeftRight,
Bitcoin,
BookUser,
Camera,
CameraOff,
CheckCircle,
ChevronDown,
ChevronUp,
CircleCheck,
ClipboardPaste,
Cog,
Copy,
Currency,
Egg,
Fingerprint,
HelpCircle,
Hotel,
Keyboard,
LogOut,
Menu,
MoveDown,
MoveDownLeft,
MoveDownRight,
MoveUp,
MoveUpRight,
Palette,
PlusCircle,
Power,
RefreshCw,
Settings2,
Share2,
Trash2,
TriangleAlert,
UserCircle2,
Wallet2,
AlertCircleIcon,
BitcoinIcon,
BookUserIcon,
CameraOffIcon,
CheckCircleIcon,
ChevronUpIcon,
CopyIcon,
EditIcon,
ExportIcon,
FingerprintIcon,
HelpCircleIcon,
MoveDownIcon,
MoveUpIcon,
OnboardingIcon,
PasteIcon,
RefreshIcon,
ResetIcon,
SettingsIcon,
ShareIcon,
SignOutIcon,
SwapIcon,
ThemeIcon,
TrashIcon,
TriangleAlertIcon,
WalletIcon,
X,
XCircle,
WithdrawIcon,
XCircleIcon,
XIcon,
ZapIcon,
};
13 changes: 10 additions & 3 deletions components/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ import { useIsFocused } from "@react-navigation/native";
import { Camera } from "expo-camera";
import { PermissionStatus } from "expo-modules-core/src/PermissionsInterface";
import React, { useEffect } from "react";
import { View } from "react-native";
import { StyleSheet, View } from "react-native";
import { CameraOffIcon } from "~/components/Icons";
import { Text } from "~/components/ui/text";
import { FocusableCamera } from "./FocusableCamera";
import { CameraOff } from "./Icons";
import Loading from "./Loading";

const styles = StyleSheet.create({
icon: {
width: 64,
height: 64,
},
});

interface QRCodeScannerProps {
onScanned: (data: string) => void;
startScanning: boolean;
Expand Down Expand Up @@ -63,7 +70,7 @@ function QRCodeScanner({
<>
{!isScanning && permissionStatus === PermissionStatus.DENIED && (
<View className="flex-1 h-full flex flex-col items-center justify-center gap-2 p-6">
<CameraOff className="text-foreground" size={64} />
<CameraOffIcon className="text-foreground" style={styles.icon} />
<Text className="text-2xl text-foreground text-center">
Camera Permission Denied
</Text>
Expand Down
10 changes: 5 additions & 5 deletions components/ToastConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Link } from "expo-router";
import { View } from "react-native";
import { ToastConfig } from "react-native-toast-message";
import { CircleCheck, XCircle } from "./Icons";
import { CheckCircleIcon, XCircleIcon } from "~/components/Icons";
import { Button } from "./ui/button";
import { Text } from "./ui/text";

export const toastConfig: ToastConfig = {
success: ({ text1, text2 }) => (
<View className="bg-foreground rounded-xl px-6 py-3 mx-6">
<View className="flex flex-row gap-2 justify-center items-center">
<CircleCheck className="text-background" width={16} height={16} />
<CheckCircleIcon className="text-background" width={16} height={16} />
<Text className="text-background font-semibold2">{text1}</Text>
</View>
{text2 && <Text className="text-background text-center">{text2}</Text>}
Expand All @@ -18,7 +18,7 @@ export const toastConfig: ToastConfig = {
info: ({ text1, text2, hide }) => (
<View className="bg-yellow-500 rounded-full px-6 py-3 mx-6">
<View className="flex flex-row gap-2 justify-center items-center">
<XCircle className="text-background" width={16} height={16} />
<XCircleIcon className="text-background" width={16} height={16} />
<Text className="text-background font-semibold2">{text1}</Text>
</View>
{text2 && <Text className="text-background text-center">{text2}</Text>}
Expand All @@ -27,7 +27,7 @@ export const toastConfig: ToastConfig = {
error: ({ text1, text2, hide }) => (
<View className="bg-destructive rounded-xl px-6 py-3 mx-6">
<View className="flex flex-row gap-2 justify-center items-center">
<XCircle className="text-background" width={16} height={16} />
<XCircleIcon className="text-background" width={16} height={16} />
<Text className="text-background font-semibold2">{text1}</Text>
</View>
{text2 && <Text className="text-background text-center">{text2}</Text>}
Expand All @@ -37,7 +37,7 @@ export const toastConfig: ToastConfig = {
return (
<View className="bg-foreground rounded-xl px-6 py-3 mx-6 flex flex-col gap-2">
<View className="flex flex-row gap-2 justify-center items-center">
<XCircle className="text-background" width={16} height={16} />
<XCircleIcon className="text-background" width={16} height={16} />
<Text className="text-background font-semibold2">{text1}</Text>
</View>
<Link href={`/settings/wallets`} asChild>
Expand Down
7 changes: 4 additions & 3 deletions components/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as DialogPrimitive from "@rn-primitives/dialog";
import * as React from "react";
import { Platform, StyleSheet, View } from "react-native";
import Animated, { FadeIn, FadeOut } from "react-native-reanimated";
import { XIcon } from "~/components/Icons";
import { cn } from "~/lib/utils";
import { X } from "../Icons";

const Dialog = DialogPrimitive.Root;

Expand Down Expand Up @@ -93,12 +93,13 @@ const DialogContent = React.forwardRef<
"absolute right-4 top-4 p-0.5 web:group rounded-sm opacity-70 web:ring-offset-background web:transition-opacity web:hover:opacity-100 web:focus:outline-none web:focus:ring-2 web:focus:ring-ring web:focus:ring-offset-2 web:disabled:pointer-events-none"
}
>
<X
size={Platform.OS === "web" ? 16 : 18}
<XIcon
className={cn(
"text-muted-foreground",
open && "text-accent-foreground",
)}
width={Platform.OS === "web" ? 16 : 18}
height={Platform.OS === "web" ? 16 : 18}
/>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"dependencies": {
"@getalby/lightning-tools": "^5.1.1",
"@getalby/sdk": "^3.8.2",
"@popicons/react-native": "^0.0.20",
"@react-native-async-storage/async-storage": "1.23.1",
"@rn-primitives/dialog": "^1.0.3",
"@rn-primitives/portal": "^1.0.3",
Expand All @@ -48,7 +49,6 @@
"expo-secure-store": "~14.0.0",
"expo-status-bar": "~2.0.0",
"lottie-react-native": "7.1.0",
"lucide-react-native": "^0.376.0",
"message-port-polyfill": "^0.2.0",
"nativewind": "^4.0.1",
"react": "18.3.1",
Expand Down
Loading
Loading