Skip to content

Commit

Permalink
feat(gr-sheet): Add copy log button
Browse files Browse the repository at this point in the history
  • Loading branch information
ribose-jeffreylau committed Jan 2, 2025
1 parent 4870619 commit f5f0423
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/webgui/src/app.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
font-size: 90%;
padding: 2rem;
}

.copyLog {
position: fixed;
top: 1rem;
right: 1rem;
}
}

.hidden {
Expand Down
14 changes: 14 additions & 0 deletions packages/webgui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,25 @@ const App: React.FC<Record<never, never>> = function () {
</>
: <>No convertor is available.</>}
</div>
<div className={styles.copyLog}>
<CopyLogButton log={_log} />
</div>
</div>
</div>
);
};

const CopyLogButton: React.FC<{ log: string[] }> = ({ log }) => {
return (
<button
onClick={() => {
navigator.clipboard.writeText(log.join('\n'));
}}
>
Copy log to clipboard
</button>
);
};

const DropReceiver: React.FC<{
onDrop: (input?: Upload) => void;
Expand Down

0 comments on commit f5f0423

Please sign in to comment.