Spaces:
Runtime error
Runtime error
Download frontend/src/components/ExportSheet.tsx from npisb/pipecountapp-dev: direct link, hf CLI and curl.
- Browser
- Download file 3.75 kB
-
https://huggingface.co/spaces/npisb/pipecountapp-dev/resolve/main/frontend/src/components/ExportSheet.tsx
- Command line
-
hf download hf://spaces/npisb/pipecountapp-dev/frontend/src/components/ExportSheet.tsx
-
curl -L -o ExportSheet.tsx https://huggingface.co/spaces/npisb/pipecountapp-dev/resolve/main/frontend/src/components/ExportSheet.tsx
3.75 kB
| import { FileJson, FileSpreadsheet, Image } from 'lucide-react' | |
| import { t } from '../lib/i18n' | |
| import type { Lang } from '../lib/types' | |
| interface Props { | |
| lang: Lang | |
| open: boolean | |
| onClose: () => void | |
| onExportPng: () => void | |
| onExportJson: () => void | |
| onExportCsv: () => void | |
| canExportPng: boolean | |
| canExportData: boolean | |
| } | |
| export function ExportSheet({ | |
| lang, | |
| open, | |
| onClose, | |
| onExportPng, | |
| onExportJson, | |
| onExportCsv, | |
| canExportPng, | |
| canExportData, | |
| }: Props) { | |
| if (!open) return null | |
| return ( | |
| <> | |
| <button | |
| type="button" | |
| className="overlay-enter fixed inset-0 z-50 bg-black/40 backdrop-blur-sm" | |
| aria-label="Close" | |
| onClick={onClose} | |
| /> | |
| <div | |
| className="sheet-enter fixed inset-x-0 bottom-0 z-50 rounded-t-[1.75rem] bg-[var(--surface)] shadow-2xl ring-1 ring-[var(--hairline)]" | |
| style={{ paddingBottom: 'max(1.25rem, env(safe-area-inset-bottom))' }} | |
| > | |
| <div className="flex justify-center pt-3 pb-1"> | |
| <div className="h-1 w-9 rounded-full bg-[var(--hairline)]" /> | |
| </div> | |
| <h2 className="px-5 pb-3 pt-2 text-center text-[17px] font-semibold text-[var(--text)]"> | |
| {t(lang, 'export')} | |
| </h2> | |
| <div className="mx-4 overflow-hidden rounded-2xl border border-[var(--hairline)] bg-[var(--surface-2)]"> | |
| <button | |
| type="button" | |
| disabled={!canExportPng} | |
| className="flex min-h-[52px] w-full items-center gap-4 px-4 text-left transition-colors duration-150 disabled:opacity-40 active:bg-[var(--surface-active)]" | |
| onClick={() => { onExportPng(); onClose() }} | |
| > | |
| <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-[var(--info-light)]"> | |
| <Image size={18} className="text-[var(--info)]" /> | |
| </span> | |
| <span className="text-[15px] font-medium text-[var(--text)]">{t(lang, 'exportPng')}</span> | |
| </button> | |
| <div className="ml-[3.25rem] h-px bg-[var(--hairline)]" /> | |
| <button | |
| type="button" | |
| disabled={!canExportData} | |
| className="flex min-h-[52px] w-full items-center gap-4 px-4 text-left transition-colors duration-150 disabled:opacity-40 active:bg-[var(--surface-active)]" | |
| onClick={() => { onExportJson(); onClose() }} | |
| > | |
| <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-[var(--warning-light)]"> | |
| <FileJson size={18} className="text-[var(--warning)]" /> | |
| </span> | |
| <span className="text-[15px] font-medium text-[var(--text)]">{t(lang, 'exportJson')}</span> | |
| </button> | |
| <div className="ml-[3.25rem] h-px bg-[var(--hairline)]" /> | |
| <button | |
| type="button" | |
| disabled={!canExportData} | |
| className="flex min-h-[52px] w-full items-center gap-4 px-4 text-left transition-colors duration-150 disabled:opacity-40 active:bg-[var(--surface-active)]" | |
| onClick={() => { onExportCsv(); onClose() }} | |
| > | |
| <span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-[var(--success-light)]"> | |
| <FileSpreadsheet size={18} className="text-[var(--success)]" /> | |
| </span> | |
| <span className="text-[15px] font-medium text-[var(--text)]">{t(lang, 'exportCsv')}</span> | |
| </button> | |
| </div> | |
| <div className="mx-4 mt-2.5"> | |
| <button | |
| type="button" | |
| className="ct-btn-secondary min-h-[50px] text-[15px]" | |
| onClick={onClose} | |
| > | |
| {t(lang, 'cancel')} | |
| </button> | |
| </div> | |
| </div> | |
| </> | |
| ) | |
| } | |