-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: ✨ add a way to create a watermark images to post on artists RRSS * fix: ⚡ update unhandled methods on unused parts of the dashboard
- Loading branch information
1 parent
ef5364c
commit d1e9aa3
Showing
6 changed files
with
251 additions
and
28 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
import { PlusSquareIcon } from '@chakra-ui/icons'; | ||
import { Box, Button, Flex, Image, Input } from '@chakra-ui/react'; | ||
import useImageHandler from 'common/hooks/useImageHandler'; | ||
import { captureHtmlAndSavePng } from 'common/utils'; | ||
import React, { useState } from 'react'; | ||
import { AiOutlineClose } from 'react-icons/ai'; | ||
|
||
const WatermarkComponent: React.FC = () => { | ||
|
||
const { selectedImage, fileName, imageHandler } = useImageHandler(); | ||
|
||
return ( | ||
<Flex | ||
gap="4" | ||
mt="10px" | ||
width="100%" | ||
maxWidth="1280px" | ||
minH={{ lg: "777px", "2xl": "900px" }} | ||
mx="auto" | ||
direction={{ base: "column-reverse", md: "column" }} | ||
px={{ base: 4, md: 4 }} | ||
alignItems="center" | ||
> | ||
<Box | ||
w={{ base: "100%", md: "75%" }} | ||
height="100%" | ||
bg="whiteAlpha.100" | ||
p="20px" | ||
borderRadius={8} | ||
> | ||
<Flex gap={2}> | ||
<Box | ||
as="label" | ||
className="custom-file-upload" | ||
htmlFor="image-importer" | ||
h="auto" | ||
> | ||
<Flex> | ||
<Box | ||
bg="whiteAlpha.200" | ||
px={2} | ||
py={3} | ||
borderRadius="6px 0px 0px 6px" | ||
_hover={{ | ||
bg: "whiteAlpha.300", | ||
}} | ||
> | ||
<PlusSquareIcon /> Subir imagen | ||
<Input | ||
id="image-importer" | ||
key={selectedImage ? fileName : 'input'} | ||
type="file" | ||
onChange={(e: any) => { | ||
imageHandler(e); | ||
}} | ||
></Input> | ||
</Box> | ||
|
||
<Button | ||
borderRadius="0px 6px 6px 0px" | ||
h="auto" | ||
onClick={() => imageHandler(null)} | ||
disabled={!selectedImage} | ||
> | ||
<AiOutlineClose /> | ||
</Button> | ||
</Flex> | ||
</Box> | ||
|
||
<Button | ||
ml={4} | ||
h="auto" | ||
onClick={() => { | ||
if (!fileName) return; | ||
captureHtmlAndSavePng({ | ||
id: "watermark_image", | ||
name: fileName, | ||
quality: 5 | ||
}) | ||
} | ||
} | ||
> | ||
Guardar imagen | ||
</Button> | ||
</Flex> | ||
<Box | ||
mt="5" | ||
height="500px" | ||
width="100%" | ||
bg="whiteAlpha.100" | ||
borderRadius={8} | ||
display="flex" | ||
gap={3} | ||
p={5} | ||
backgroundImage="/images/generators/partnership/partnership_background.png" | ||
|
||
> | ||
<Box mx="auto" height="100%" width="auto"> | ||
|
||
<svg | ||
style={{ | ||
width: "100%", | ||
height: "100%", | ||
userSelect: "none", | ||
transition: "all .5s ease-in-out", | ||
}} | ||
id="watermark_image" | ||
viewBox="60 0 649 1120" | ||
> | ||
{selectedImage ? | ||
<> | ||
<g> | ||
<image | ||
type="MSBitmapLayer" | ||
x={0} | ||
y={0} | ||
width={769} | ||
height={1120} | ||
href={selectedImage} | ||
/> | ||
</g> | ||
<g> | ||
<image | ||
type="MSBitmapLayer" | ||
alignmentBaseline='middle' | ||
x={490} | ||
y={520} | ||
width={200} | ||
height={1100} | ||
href="/images/fxd_logo.svg" | ||
opacity={0.7} | ||
/> | ||
</g> | ||
</> | ||
: null} | ||
</svg> | ||
</Box> | ||
</Box> | ||
</Box> | ||
|
||
</Flex> | ||
); | ||
}; | ||
|
||
export default WatermarkComponent; |
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 |
---|---|---|
|
@@ -9872,10 +9872,10 @@ typedarray-to-buffer@^3.1.5: | |
dependencies: | ||
is-typedarray "^1.0.0" | ||
|
||
[email protected].4: | ||
version "4.9.4" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78" | ||
integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg== | ||
[email protected].5: | ||
version "4.9.5" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" | ||
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== | ||
|
||
ua-parser-js@^0.7.18: | ||
version "0.7.32" | ||
|