Remove customName from state

This commit is contained in:
Arun Kumar
2021-03-19 01:30:27 +05:30
parent db4ed1ecb1
commit f774452124
8 changed files with 9 additions and 79 deletions
+2 -4
View File
@@ -304,7 +304,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
zenModeEnabled = false,
gridModeEnabled = false,
theme = defaultAppState.theme,
name,
name = defaultAppState.name,
} = props;
this.state = {
...defaultAppState,
@@ -316,8 +316,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
viewModeEnabled,
zenModeEnabled,
gridSize: gridModeEnabled ? GRID_SIZE : null,
name: name ? name : defaultAppState.name,
customName: typeof name === "string",
name,
};
if (excalidrawRef) {
const readyPromise =
@@ -565,7 +564,6 @@ class App extends React.Component<ExcalidrawProps, AppState> {
gridSize,
theme,
name,
customName: typeof this.props.name === "string",
});
},
() => {
+2 -2
View File
@@ -7,7 +7,7 @@ type Props = {
value: string;
onChange: (value: string) => void;
label: string;
customName: boolean;
isNameEditable: boolean;
};
export class ProjectName extends Component<Props> {
@@ -44,7 +44,7 @@ export class ProjectName extends Component<Props> {
};
public render() {
return this.props.customName ? (
return this.props.isNameEditable ? (
<span className="TextInput" aria-label={this.props.label}>
{this.props.value}
</span>