caelum0x d56639a594
Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

109 lines
2.4 KiB
TypeScript

/**
* Modal primitive — a centered dialog overlay.
* Uses React Native's Modal component. No emoji.
*/
import type { ReactNode } from "react";
import {
Modal as RNModal,
Pressable,
StyleSheet,
Text,
View,
type StyleProp,
type ViewStyle,
} from "react-native";
import { colors } from "@/components/me/theme";
import { radius, spacing, weight } from "@/src/shared/theme";
export interface ModalProps {
visible: boolean;
onClose: () => void;
title?: string;
children: ReactNode;
style?: StyleProp<ViewStyle>;
/** Whether tapping the backdrop closes the modal. Defaults true. */
closeOnBackdrop?: boolean;
}
export function Modal({
visible,
onClose,
title,
children,
style,
closeOnBackdrop = true,
}: ModalProps): React.JSX.Element {
return (
<RNModal
visible={visible}
transparent
animationType="fade"
onRequestClose={onClose}
statusBarTranslucent
>
<Pressable
style={styles.backdrop}
onPress={closeOnBackdrop ? onClose : undefined}
/>
<View style={styles.centeredContainer} pointerEvents="box-none">
<View style={[styles.dialog, style]}>
{title ? (
<View style={styles.titleRow}>
<Text style={styles.title}>{title}</Text>
<Pressable
onPress={onClose}
accessibilityRole="button"
accessibilityLabel="Close"
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
>
<Text style={styles.closeBtn}>{"x"}</Text>
</Pressable>
</View>
) : null}
{children}
</View>
</View>
</RNModal>
);
}
const styles = StyleSheet.create({
backdrop: {
...StyleSheet.absoluteFillObject,
backgroundColor: "rgba(0,0,0,0.65)",
},
centeredContainer: {
...StyleSheet.absoluteFillObject,
alignItems: "center",
justifyContent: "center",
padding: spacing.xl,
},
dialog: {
backgroundColor: colors.card,
borderColor: colors.border,
borderWidth: 1,
borderRadius: radius.lg,
padding: spacing.lg,
width: "100%",
maxWidth: 420,
gap: spacing.md,
},
titleRow: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
},
title: {
color: colors.textPrimary,
fontSize: 16,
fontWeight: weight.bold,
},
closeBtn: {
color: colors.muted,
fontSize: 18,
fontWeight: weight.bold,
},
});