diff --git a/src/components/SlateEditor/plugins/grid/SlateGrid.tsx b/src/components/SlateEditor/plugins/grid/SlateGrid.tsx
index c055590fef..0605d481d6 100644
--- a/src/components/SlateEditor/plugins/grid/SlateGrid.tsx
+++ b/src/components/SlateEditor/plugins/grid/SlateGrid.tsx
@@ -10,36 +10,39 @@ import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
import { Editor, Path, Transforms } from "slate";
import { ReactEditor, RenderElementProps } from "slate-react";
-import styled from "@emotion/styled";
-import { spacing } from "@ndla/core";
+import { Portal } from "@ark-ui/react";
import { Pencil } from "@ndla/icons/action";
-import { Modal, ModalBody, ModalCloseButton, ModalContent, ModalHeader, ModalTitle, ModalTrigger } from "@ndla/modal";
-import { IconButton } from "@ndla/primitives";
+import {
+ DialogBody,
+ DialogContent,
+ DialogHeader,
+ DialogRoot,
+ DialogTitle,
+ DialogTrigger,
+ IconButton,
+} from "@ndla/primitives";
+import { styled } from "@ndla/styled-system/jsx";
import { EmbedWrapper, Grid, GridType } from "@ndla/ui";
import { GridElement } from ".";
import { GridProvider } from "./GridContext";
import GridForm from "./GridForm";
import DeleteButton from "../../../DeleteButton";
+import { DialogCloseButton } from "../../../DialogCloseButton";
interface Props extends RenderElementProps {
element: GridElement;
editor: Editor;
}
-const StyledModalHeader = styled(ModalHeader)`
- padding-bottom: 0px;
-`;
-
-const StyledModalBody = styled(ModalBody)`
- padding-top: 0px;
-`;
-
-const ButtonContainer = styled.div`
- display: flex;
- flex-direction: column;
- position: absolute;
- right: -${spacing.large};
-`;
+const ButtonContainer = styled("div", {
+ base: {
+ display: "flex",
+ flexDirection: "column",
+ position: "absolute",
+ right: "-xlarge",
+ gap: "3xsmall",
+ },
+});
export const SlateGrid = ({ element, editor, children }: Props) => {
const { t } = useTranslation();
@@ -78,31 +81,33 @@ export const SlateGrid = ({ element, editor, children }: Props) => {
);
return (
-
-
-
-
-
+ setIsEditing(details.open)}>
+
+
+
+
-
-
-
- {t("gridForm.title")}
-
-
-
-
-
-
-
-
-
-
- {children}
-
-
-
+
+
+
+
+ {t("gridForm.title")}
+
+
+
+
+
+
+
+
+
+
+ {children}
+
+
+
+
);
};
diff --git a/src/components/SlateEditor/plugins/grid/SlateGridCell.tsx b/src/components/SlateEditor/plugins/grid/SlateGridCell.tsx
index 2a5c5a1d1e..c6e9ce1125 100644
--- a/src/components/SlateEditor/plugins/grid/SlateGridCell.tsx
+++ b/src/components/SlateEditor/plugins/grid/SlateGridCell.tsx
@@ -10,10 +10,9 @@ import { useCallback, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { Editor, Transforms } from "slate";
import { ReactEditor, RenderElementProps } from "slate-react";
-import styled from "@emotion/styled";
-import { spacing, colors, stackOrder } from "@ndla/core";
import { Pin } from "@ndla/icons/common";
import { IconButton } from "@ndla/primitives";
+import { styled } from "@ndla/styled-system/jsx";
import { GridCellElement } from ".";
interface Props extends RenderElementProps {
@@ -21,12 +20,14 @@ interface Props extends RenderElementProps {
element: GridCellElement;
}
-const StyledButton = styled(IconButton)`
- position: absolute;
- z-index: ${stackOrder.offsetDouble};
- top: ${spacing.xxsmall};
- right: ${spacing.xxsmall};
-`;
+const StyledIconButton = styled(IconButton, {
+ base: {
+ position: "absolute",
+ zIndex: "docked",
+ top: "xxsmall",
+ right: "xxsmall",
+ },
+});
// TODO: Having the sticky button messes with the actual styling of the cell (I think)
// TODO: We seem to render empty paragraphs in the grid cells, which messes with margin.
@@ -46,7 +47,7 @@ const GridCell = ({ element, editor, attributes, children }: Props) => {
return (
- {
data-testid="grid-cell-parallax"
>
-
+
{children}
);
};
-const StyledGridCell = styled.div`
- position: relative;
- display: flex;
- flex-direction: column;
- border: 1px solid ${colors.brand.light};
- min-width: 50px;
-
- overflow-wrap: break-word;
-
- > p {
- padding: 0 ${spacing.xxsmall};
- word-break: break-word;
- }
-
- > div,
- > figure,
- > iframe {
- width: 100% !important;
- inset: 0;
- }
-`;
+const StyledGridCell = styled("div", {
+ base: {
+ position: "relative",
+ display: "flex",
+ flexDirection: "column",
+ border: "1px solid",
+ borderColor: "stroke.default",
+ minWidth: "xxlarge",
+ },
+});
export default GridCell;