-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a drop-down menu action to extract selected instances as an exter…
…nal layout (#6561)
- Loading branch information
Showing
7 changed files
with
142 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
newIDE/app/src/SceneEditor/ExtractAsExternalLayoutDialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// @flow | ||
import { Trans } from '@lingui/macro'; | ||
import * as React from 'react'; | ||
import FlatButton from '../UI/FlatButton'; | ||
import Text from '../UI/Text'; | ||
import TextField from '../UI/TextField'; | ||
import { ColumnStackLayout } from '../UI/Layout'; | ||
import Dialog, { DialogPrimaryButton } from '../UI/Dialog'; | ||
import HelpButton from '../UI/HelpButton'; | ||
|
||
type Props = {| | ||
suggestedName: string, | ||
onApply: (chosenName: string) => void, | ||
onCancel: () => void, | ||
|}; | ||
|
||
export default function ExtractAsExternalLayoutDialog({ | ||
suggestedName, | ||
onApply, | ||
onCancel, | ||
}: Props) { | ||
const [chosenName, setChosenName] = React.useState<string>(suggestedName); | ||
|
||
const apply = React.useCallback(() => onApply(suggestedName), [ | ||
onApply, | ||
suggestedName, | ||
]); | ||
|
||
return ( | ||
<Dialog | ||
title={<Trans>Extract as an external layout</Trans>} | ||
actions={[ | ||
<FlatButton | ||
key="cancel" | ||
label={<Trans>Cancel</Trans>} | ||
primary={false} | ||
onClick={onCancel} | ||
/>, | ||
<DialogPrimaryButton | ||
key="apply" | ||
label={<Trans>Move instances</Trans>} | ||
primary={true} | ||
onClick={apply} | ||
/>, | ||
]} | ||
secondaryActions={[ | ||
<HelpButton | ||
helpPagePath="/interface/scene-editor/external-layouts/" | ||
key="help" | ||
/>, | ||
]} | ||
onRequestClose={onCancel} | ||
onApply={apply} | ||
open | ||
maxWidth="sm" | ||
exceptionallyStillAllowRenderingInstancesEditors | ||
> | ||
<ColumnStackLayout noMargin> | ||
<Text> | ||
<Trans> | ||
Selected instances will be moved to a new external layout. | ||
</Trans> | ||
</Text> | ||
<TextField | ||
floatingLabelText={<Trans>External layout name</Trans>} | ||
fullWidth | ||
value={chosenName} | ||
onChange={(e, value) => setChosenName(value)} | ||
/> | ||
</ColumnStackLayout> | ||
</Dialog> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters