Toggle Orientation now works dynamically (for real this time :( )
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { BoardContainer } from "../index.jsx";
|
import { BoardContainer } from "../index";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { v1 } from "uuid";
|
import { v1 } from "uuid";
|
||||||
@@ -8,10 +8,10 @@ const Board = ({ id, className, components, orientation, ...additionalProps }) =
|
|||||||
|
|
||||||
const allClassNames = classNames("react-trello-board", className || "");
|
const allClassNames = classNames("react-trello-board", className || "");
|
||||||
|
|
||||||
|
const GlobalStyle = orientation === "horizontal" ? components.GlobalStyleHorizontal : components.GlobalStyleVertical;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<GlobalStyle>
|
||||||
{orientation === "horizontal" && <components.GlobalStyleHorizontal />}
|
|
||||||
{orientation === "vertical" && <components.GlobalStyleVertical />}
|
|
||||||
<BoardContainer
|
<BoardContainer
|
||||||
components={components}
|
components={components}
|
||||||
orientation={orientation}
|
orientation={orientation}
|
||||||
@@ -19,7 +19,7 @@ const Board = ({ id, className, components, orientation, ...additionalProps }) =
|
|||||||
id={storeId}
|
id={storeId}
|
||||||
className={allClassNames}
|
className={allClassNames}
|
||||||
/>
|
/>
|
||||||
</>
|
</GlobalStyle>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const getSectionStyles = (props) => {
|
|||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
export const GlobalStyleHorizontal = createGlobalStyle`
|
export const GlobalStyleHorizontal = styled.div`
|
||||||
.comPlainTextContentEditable {
|
.comPlainTextContentEditable {
|
||||||
-webkit-user-modify: read-write-plaintext-only;
|
-webkit-user-modify: read-write-plaintext-only;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
@@ -49,7 +49,8 @@ export const GlobalStyleHorizontal = createGlobalStyle`
|
|||||||
content: "\\E91F";
|
content: "\\E91F";
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-lg, .icon-sm {
|
.icon-lg,
|
||||||
|
.icon-sm {
|
||||||
color: #798d99;
|
color: #798d99;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,13 +61,12 @@ export const GlobalStyleHorizontal = createGlobalStyle`
|
|||||||
width: 32px;
|
width: 32px;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
export const GlobalStyleVertical = createGlobalStyle`
|
export const GlobalStyleVertical = styled.div`
|
||||||
.comPlainTextContentEditable {
|
.comPlainTextContentEditable {
|
||||||
-webkit-user-modify: read-write-plaintext-only;
|
-webkit-user-modify: read-write-plaintext-only;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
}
|
}
|
||||||
.smooth-dnd-container.horizontal {
|
.smooth-dnd-container.horizontal {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.comPlainTextContentEditable--has-placeholder::before {
|
.comPlainTextContentEditable--has-placeholder::before {
|
||||||
@@ -88,7 +88,8 @@ export const GlobalStyleVertical = createGlobalStyle`
|
|||||||
content: "\\E91F";
|
content: "\\E91F";
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-lg, .icon-sm {
|
.icon-lg,
|
||||||
|
.icon-sm {
|
||||||
color: #798d99;
|
color: #798d99;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ export const GlobalStyleVertical = createGlobalStyle`
|
|||||||
}
|
}
|
||||||
|
|
||||||
.smooth-dnd-container {
|
.smooth-dnd-container {
|
||||||
// TODO ? This is the question. We need the same drag-zone we get in horizontal mode
|
// TODO ? This is the question. We need the same drag-zone we get in horizontal mode
|
||||||
min-height: 50px; // Not needed, just for extra landing space
|
min-height: 50px; // Not needed, just for extra landing space
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user