Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

Minor redesign of Export Dialog (#604)

Lipisba4fc0f1b351
diff --git a/src/actions/actionExport.tsx b/src/actions/actionExport.tsx
index af540cd408..6d3841b38d 100644
--- a/src/actions/actionExport.tsx
+++ b/src/actions/actionExport.tsx
@@ -1,6 +1,6 @@
import React from "react";
import { Action } from "./types";
-import { EditableText } from "../components/EditableText";
+import { ProjectName } from "../components/ProjectName";
import { saveAsJSON, loadFromJSON } from "../scene";
import { load, save } from "../components/icons";
import { ToolButton } from "../components/ToolButton";
@@ -11,7 +11,7 @@ export const actionChangeProjectName: Action = {
return { appState: { ...appState, name: value } };
},
PanelComponent: ({ appState, updateData, t }) => (
- <EditableText
+ <ProjectName
label={t("labels.fileTitle")}
value={appState.name || "Unnamed"}
onChange={(name: string) => updateData(name)}
diff --git a/src/components/ExportDialog.css b/src/components/ExportDialog.css
index 547298fa82..db1ee57a59 100644
--- a/src/components/ExportDialog.css
+++ b/src/components/ExportDialog.css
@@ -40,7 +40,7 @@
.ExportDialog__actions {
display: flex;
- align-items: center;
+ align-items: top;
justify-content: space-between;
flex-wrap: wrap;
}
diff --git a/src/components/ExportDialog.tsx b/src/components/ExportDialog.tsx
index 72258d4501..d4a7a409e1 100644
--- a/src/components/ExportDialog.tsx
+++ b/src/components/ExportDialog.tsx
@@ -129,39 +129,41 @@ function ExportModal({
<h2 id="export-title">{t("buttons.export")}</h2>
<div className="ExportDialog__preview" ref={previewRef}></div>
<div className="ExportDialog__actions">
- <Stack.Row gap={2}>
- <ToolButton
- type="button"
- icon={downloadFile}
- title={t("buttons.exportToPng")}
- aria-label={t("buttons.exportToPng")}
- onClick={() => onExportToPng(exportedElements, scale)}
- ref={pngButton}
- />
- <ToolButton
- type="button"
- icon={svgFile}
- title={t("buttons.exportToSvg")}
- aria-label={t("buttons.exportToSvg")}
- onClick={() => onExportToSvg(exportedElements, scale)}
- />
- {probablySupportsClipboard && (
+ <Stack.Col gap={1}>
+ <Stack.Row gap={2}>
<ToolButton
type="button"
- icon={clipboard}
- title={t("buttons.copyToClipboard")}
- aria-label={t("buttons.copyToClipboard")}
- onClick={() => onExportToClipboard(exportedElements, scale)}
+ icon={downloadFile}
+ title={t("buttons.exportToPng")}
+ aria-label={t("buttons.exportToPng")}
+ onClick={() => onExportToPng(exportedElements, scale)}
+ ref={pngButton}
/>
- )}
- <ToolButton
- type="button"
- icon={link}
- title={t("buttons.getShareableLink")}
- aria-label={t("buttons.getShareableLink")}
- onClick={() => onExportToBackend(exportedElements)}
- />
- </Stack.Row>
+ <ToolButton
+ type="button"
+ icon={svgFile}
+ title={t("buttons.exportToSvg")}
+ aria-label={t("buttons.exportToSvg")}
+ onClick={() => onExportToSvg(exportedElements, scale)}
+ />
+ {probablySupportsClipboard && (
+ <ToolButton
+ type="button"
+ icon={clipboard}
+ title={t("buttons.copyToClipboard")}
+ aria-label={t("buttons.copyToClipboard")}
+ onClick={() => onExportToClipboard(exportedElements, scale)}
+ />
+ )}
+ <ToolButton
+ type="button"
+ icon={link}
+ title={t("buttons.getShareableLink")}
+ aria-label={t("buttons.getShareableLink")}
+ onClick={() => onExportToBackend(exportedElements)}
+ />
+ </Stack.Row>
+ </Stack.Col>
{actionManager.renderAction(
"changeProjectName",
@@ -172,7 +174,7 @@ function ExportModal({
)}
<Stack.Col gap={1}>
<div className="ExportDialog__scales">
- <Stack.Row gap={1} align="baseline">
+ <Stack.Row gap={2} align="baseline">
{scales.map(s => (
<ToolButton
key={s}
diff --git a/src/components/EditableText.css b/src/components/ProjectName.css
similarity index 63%
rename from src/components/EditableText.css
rename to src/components/ProjectName.css
index 43a404bea9..92068bbe27 100644
--- a/src/components/EditableText.css
+++ b/src/components/ProjectName.css
@@ -1,18 +1,19 @@
-.project-name {
+.ProjectName {
display: inline-block;
cursor: pointer;
border: none;
- padding: 0.25rem;
- margin: -0.25rem;
+ height: 2.5rem;
+ line-height: 2.5rem;
+ padding: 0 0.5rem;
white-space: nowrap;
border-radius: var(--space-factor);
}
-.project-name:hover {
+.ProjectName:hover {
background-color: #eee;
}
-.project-name:focus {
+.ProjectName:focus {
outline: none;
box-shadow: 0 0 0 2px steelblue;
}
diff --git a/src/components/EditableText.tsx b/src/components/ProjectName.tsx
similarity index 90%
rename from src/components/EditableText.tsx
rename to src/components/ProjectName.tsx
index eeda1d6248..f13d154ade 100644
--- a/src/components/EditableText.tsx
+++ b/src/components/ProjectName.tsx
@@ -1,4 +1,4 @@
-import "./EditableText.css";
+import "./ProjectName.css";
import React, { Component } from "react";
import { selectNode, removeSelection } from "../utils";
@@ -9,7 +9,7 @@ type Props = {
label: string;
};
-export class EditableText extends Component<Props> {
+export class ProjectName extends Component<Props> {
private handleFocus = (e: React.FocusEvent<HTMLElement>) => {
selectNode(e.currentTarget);
};
@@ -33,7 +33,7 @@ export class EditableText extends Component<Props> {
suppressContentEditableWarning
contentEditable="true"
data-type="wysiwyg"
- className="project-name"
+ className="ProjectName"
role="textbox"
aria-label={this.props.label}
onBlur={this.handleBlur}