-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a close button to close document
- Loading branch information
Showing
4 changed files
with
44 additions
and
22 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
import { Flex, View, Text } from '@adobe/react-spectrum'; | ||
import { Flex, View, Text, ActionButton, TooltipTrigger, Tooltip } from '@adobe/react-spectrum'; | ||
import CloseCircle from '@spectrum-icons/workflow/CloseCircle'; | ||
import { observer } from 'mobx-react-lite'; | ||
import { useTranslation } from 'react-i18next'; | ||
import store from '@store'; | ||
import Canvas from '@Canvas'; | ||
|
||
export default observer(() => ( | ||
<Flex flexGrow={1} width={0} direction="column"> | ||
<View backgroundColor="gray-300" paddingX="size-200" paddingY="size-100"> | ||
{store.activeDocument!.name} | ||
</View> | ||
<Canvas /> | ||
<View backgroundColor="gray-300" paddingY="size-0"> | ||
<Flex> | ||
<View backgroundColor="gray-200" width="size-1200" paddingX="size-100" paddingY="size-50"> | ||
<Flex justifyContent="center"> | ||
<Text>{(store.activeDocument!.viewOptions.scale * 100).toFixed(2)}%</Text> | ||
</Flex> | ||
</View> | ||
<View paddingX="size-200" paddingY="size-50"> | ||
{/* eslint-disable-next-line i18next/no-literal-string */} | ||
{store.activeDocument!.width}×{store.activeDocument!.height} | ||
</View> | ||
</Flex> | ||
</View> | ||
</Flex> | ||
)); | ||
export default observer(() => { | ||
const { t } = useTranslation(); | ||
return ( | ||
<Flex flexGrow={1} width={0} direction="column"> | ||
<View backgroundColor="gray-300" paddingX="size-200" paddingY="size-100"> | ||
<Flex justifyContent="center" alignItems="center"> | ||
<Text>{store.activeDocument!.name}</Text> | ||
<TooltipTrigger> | ||
<ActionButton isQuiet onPress={store.closeDocument} marginStart="size-100"> | ||
<CloseCircle /> | ||
</ActionButton> | ||
<Tooltip>{t('close')}</Tooltip> | ||
</TooltipTrigger> | ||
</Flex> | ||
</View> | ||
<Canvas /> | ||
<View backgroundColor="gray-300" paddingY="size-0"> | ||
<Flex> | ||
<View backgroundColor="gray-200" width="size-1200" paddingX="size-100" paddingY="size-50"> | ||
<Flex justifyContent="center"> | ||
<Text>{(store.activeDocument!.viewOptions.scale * 100).toFixed(2)}%</Text> | ||
</Flex> | ||
</View> | ||
<View paddingX="size-200" paddingY="size-50"> | ||
{/* eslint-disable-next-line i18next/no-literal-string */} | ||
{store.activeDocument!.width}×{store.activeDocument!.height} | ||
</View> | ||
</Flex> | ||
</View> | ||
</Flex> | ||
); | ||
}); |
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 |
---|---|---|
|
@@ -10,4 +10,5 @@ export default { | |
create: 'Create', | ||
cancel: 'Cancel', | ||
layer: 'Layer', | ||
close: 'Close', | ||
}; |
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 |
---|---|---|
|
@@ -10,4 +10,5 @@ export default { | |
create: '新建', | ||
cancel: '取消', | ||
layer: '图层', | ||
close: '关闭', | ||
} as Translation; |
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