Spaces:
Runtime error
Runtime error
Download components/TopHeader.tsx from richuj/tile-room-visualizer: direct link, hf CLI and curl.
- Browser
- Download file 3.26 kB
-
https://huggingface.co/spaces/richuj/tile-room-visualizer/resolve/main/components/TopHeader.tsx
- Command line
-
hf download hf://spaces/richuj/tile-room-visualizer/components/TopHeader.tsx
-
curl -L -o TopHeader.tsx https://huggingface.co/spaces/richuj/tile-room-visualizer/resolve/main/components/TopHeader.tsx
3.26 kB
| import React from "react"; | |
| type TopHeaderProps = { | |
| viewMode: "before" | "after"; | |
| onViewModeChange: (mode: "before" | "after") => void; | |
| onUploadClick: () => void; | |
| onDownloadClick: () => void; | |
| onResetClick: () => void; | |
| canDownload: boolean; | |
| hasRoom: boolean; | |
| }; | |
| export function TopHeader({ | |
| viewMode, | |
| onViewModeChange, | |
| onUploadClick, | |
| onDownloadClick, | |
| onResetClick, | |
| canDownload, | |
| hasRoom, | |
| }: TopHeaderProps) { | |
| return ( | |
| <header className="topbar"> | |
| <div className="topbar-left"> | |
| <svg | |
| className="brand-icon" | |
| viewBox="0 0 24 24" | |
| fill="none" | |
| stroke="currentColor" | |
| strokeWidth="2" | |
| strokeLinecap="round" | |
| strokeLinejoin="round" | |
| > | |
| <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /> | |
| <polyline points="9 22 9 12 15 12 15 22" /> | |
| </svg> | |
| <h1>My Room Visualizer</h1> | |
| </div> | |
| <div className="topbar-center"> | |
| <div className="segmented-control"> | |
| <button | |
| className={viewMode === "before" ? "active" : ""} | |
| onClick={() => onViewModeChange("before")} | |
| > | |
| Before | |
| </button> | |
| <button | |
| className={viewMode === "after" ? "active" : ""} | |
| onClick={() => onViewModeChange("after")} | |
| > | |
| After | |
| </button> | |
| </div> | |
| </div> | |
| <div className="action-bar"> | |
| {hasRoom && ( | |
| <button className="tertiary-button" onClick={onResetClick} title="Start over with a new room"> | |
| <svg | |
| width="16" | |
| height="16" | |
| viewBox="0 0 24 24" | |
| fill="none" | |
| stroke="currentColor" | |
| strokeWidth="2" | |
| strokeLinecap="round" | |
| strokeLinejoin="round" | |
| > | |
| <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /> | |
| <path d="M3 3v5h5" /> | |
| </svg> | |
| New Room | |
| </button> | |
| )} | |
| <button className="secondary-button" onClick={onUploadClick}> | |
| <svg | |
| width="16" | |
| height="16" | |
| viewBox="0 0 24 24" | |
| fill="none" | |
| stroke="currentColor" | |
| strokeWidth="2" | |
| strokeLinecap="round" | |
| strokeLinejoin="round" | |
| > | |
| <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /> | |
| <polyline points="17 8 12 3 7 8" /> | |
| <line x1="12" y1="3" x2="12" y2="15" /> | |
| </svg> | |
| Upload Image | |
| </button> | |
| <button | |
| className="primary-button" | |
| onClick={onDownloadClick} | |
| disabled={!canDownload} | |
| > | |
| <svg | |
| width="16" | |
| height="16" | |
| viewBox="0 0 24 24" | |
| fill="none" | |
| stroke="currentColor" | |
| strokeWidth="2" | |
| strokeLinecap="round" | |
| strokeLinejoin="round" | |
| > | |
| <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /> | |
| <polyline points="7 10 12 15 17 10" /> | |
| <line x1="12" y1="15" x2="12" y2="3" /> | |
| </svg> | |
| Save Screenshot | |
| </button> | |
| </div> | |
| </header> | |
| ); | |
| } | |