Skip to content

Commit

Permalink
Merge pull request #1230 from webkom/update-bricks
Browse files Browse the repository at this point in the history
Update lego-bricks
  • Loading branch information
Bestem0r authored Sep 18, 2024
2 parents 8ee52f9 + e7e3ab0 commit f23ad60
Show file tree
Hide file tree
Showing 6 changed files with 1,359 additions and 175 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webkom/lego-editor",
"version": "2.5.0",
"version": "2.5.1",
"description": "A React editor written in TS with slate.js for lego-webapp",
"type": "module",
"main": "./dist/lego-editor.umd.cjs",
Expand Down Expand Up @@ -45,7 +45,7 @@
},
"homepage": "https://github.com/webkom/lego-editor#readme",
"dependencies": {
"@webkom/lego-bricks": "^1.2.1",
"@webkom/lego-bricks": "^1.3.3",
"classnames": "^2.2.6",
"escape-html": "^1.0.3",
"lodash": "^4.17.15",
Expand Down
1 change: 0 additions & 1 deletion src/components/ImageUpload.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
display: flex;
width: 325px;
min-width: 70%;
height: 200.861px;
min-height: 60%;
outline: none;
}
Expand Down
14 changes: 8 additions & 6 deletions src/components/ImageUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,15 @@ const ImageUpload: FunctionComponent<Props> = ({ uploadFunction, cancel }) => {
});
};

const closeModal = (): void => {
cancel();
setShowModal(false);
const onModalOpenChange = (isOpen: boolean): void => {
if (!isOpen) {
cancel();
}
setShowModal(isOpen);
};

return (
<Modal show={showModal} onHide={closeModal}>
<Modal isOpen={showModal} onOpenChange={onModalOpenChange}>
<Flex
column
alignItems="center"
Expand All @@ -140,10 +142,10 @@ const ImageUpload: FunctionComponent<Props> = ({ uploadFunction, cancel }) => {
<ImageDrop onDrop={onDrop} />
)}
<Flex wrap gap={35}>
<Button flat onClick={closeModal}>
<Button flat onPress={() => onModalOpenChange(false)}>
Avbryt
</Button>
<Button secondary disabled={!currentImage} onClick={submitImage}>
<Button secondary disabled={!currentImage} onPress={submitImage}>
Last opp
</Button>
</Flex>
Expand Down
19 changes: 9 additions & 10 deletions src/components/LinkInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ const LinkInput = (props: LinkInputProps): JSX.Element => {
props.activeLink ? Node.string(props.activeLink[0]) : '',
);

const submit = (
e?: React.FocusEvent | React.KeyboardEvent | React.MouseEvent,
): void => {
e?.preventDefault();
const submit = (): void => {
props.toggleLinkInput();
if (url == '') {
return;
Expand All @@ -58,13 +55,15 @@ const LinkInput = (props: LinkInputProps): JSX.Element => {
}
};

const closeModal = (): void => {
props.toggleLinkInput();
setShowModal(false);
const onModalOpenChange = (isOpen: boolean): void => {
if (!isOpen) {
props.toggleLinkInput();
}
setShowModal(isOpen);
};

return (
<Modal show={showModal} onHide={closeModal}>
<Modal isOpen={showModal} onOpenChange={onModalOpenChange}>
<Flex column alignItems="center" justifyContent="center" gap={20}>
<Flex column>
<label className="_legoEditor_linkInput_label">
Expand All @@ -91,10 +90,10 @@ const LinkInput = (props: LinkInputProps): JSX.Element => {
</label>
</Flex>
<Flex>
<Button flat onClick={closeModal}>
<Button flat onPress={() => onModalOpenChange(false)}>
Avbryt
</Button>
<Button secondary disabled={!isUrl(url)} onClick={submit}>
<Button secondary disabled={!isUrl(url)} onPress={submit}>
Bruk
</Button>
</Flex>
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"rootDir": "./src",
"outDir": "./dist",
"downlevelIteration": true,

"skipLibCheck": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
Expand Down
Loading

0 comments on commit f23ad60

Please sign in to comment.