@gpichot/spectacle-deck 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -67,7 +67,6 @@ var Margins = {
67
67
  };
68
68
  function getHeading(children) {
69
69
  const allChild = import_react.default.Children.toArray(children);
70
- console.log(allChild);
71
70
  if (allChild.length === 0)
72
71
  return [null, allChild];
73
72
  const [candidate, ...rest] = allChild;
@@ -128,7 +127,6 @@ var CenteredLayoutContent = import_styled_components.default.div`
128
127
  }
129
128
  `;
130
129
  var CenteredLayout = (props) => {
131
- console.log(props);
132
130
  const [heading, rest] = getHeading(props.children);
133
131
  return /* @__PURE__ */ import_react2.default.createElement(
134
132
  "div",
@@ -674,14 +672,20 @@ var DivWithHeading2 = import_styled_components8.default.div`
674
672
  font-weight: 400;
675
673
  }
676
674
  `;
675
+ function parseRatio(ratio) {
676
+ const [a, b] = ratio.split("/");
677
+ return { left: parseInt(a), right: parseInt(b) };
678
+ }
677
679
  var SidedImageLayout = ({
678
680
  children,
679
681
  image,
680
682
  position,
681
- height
683
+ height,
684
+ ratio: ratioProp
682
685
  }) => {
683
686
  const isReversed = position === "left";
684
687
  const [component, rest] = getMatchingMdxType(children, "Image") || image;
688
+ const ratio = parseRatio(ratioProp || "6/4");
685
689
  if (!image && !component.length) {
686
690
  console.error("No image provided for SidedImageLayout");
687
691
  return null;
@@ -703,7 +707,7 @@ var SidedImageLayout = ({
703
707
  "div",
704
708
  {
705
709
  style: {
706
- flex: 1,
710
+ flex: `${ratio.left || 6} 0`,
707
711
  display: "flex",
708
712
  flexDirection: "column",
709
713
  justifyContent: "center",
@@ -716,8 +720,7 @@ var SidedImageLayout = ({
716
720
  "div",
717
721
  {
718
722
  style: {
719
- flex: 1,
720
- maxWidth: "40vw",
723
+ flex: `${ratio.right || 4} 0`,
721
724
  display: "flex",
722
725
  flexDirection: "column",
723
726
  justifyContent: "center",
@@ -1662,7 +1665,6 @@ function Layout({
1662
1665
  }) {
1663
1666
  const layout = (frontmatter == null ? void 0 : frontmatter.layout) || "default";
1664
1667
  const Layout2 = layout in layouts_default ? layouts_default[layout] : null;
1665
- console.log(layout, Layout2);
1666
1668
  if (layout && !Layout2) {
1667
1669
  console.warn(`Layout ${layout} not found`);
1668
1670
  }
package/index.mjs CHANGED
@@ -16,7 +16,6 @@ var Margins = {
16
16
  };
17
17
  function getHeading(children) {
18
18
  const allChild = React.Children.toArray(children);
19
- console.log(allChild);
20
19
  if (allChild.length === 0)
21
20
  return [null, allChild];
22
21
  const [candidate, ...rest] = allChild;
@@ -77,7 +76,6 @@ var CenteredLayoutContent = styled.div`
77
76
  }
78
77
  `;
79
78
  var CenteredLayout = (props) => {
80
- console.log(props);
81
79
  const [heading, rest] = getHeading(props.children);
82
80
  return /* @__PURE__ */ React2.createElement(
83
81
  "div",
@@ -623,14 +621,20 @@ var DivWithHeading2 = styled8.div`
623
621
  font-weight: 400;
624
622
  }
625
623
  `;
624
+ function parseRatio(ratio) {
625
+ const [a, b] = ratio.split("/");
626
+ return { left: parseInt(a), right: parseInt(b) };
627
+ }
626
628
  var SidedImageLayout = ({
627
629
  children,
628
630
  image,
629
631
  position,
630
- height
632
+ height,
633
+ ratio: ratioProp
631
634
  }) => {
632
635
  const isReversed = position === "left";
633
636
  const [component, rest] = getMatchingMdxType(children, "Image") || image;
637
+ const ratio = parseRatio(ratioProp || "6/4");
634
638
  if (!image && !component.length) {
635
639
  console.error("No image provided for SidedImageLayout");
636
640
  return null;
@@ -652,7 +656,7 @@ var SidedImageLayout = ({
652
656
  "div",
653
657
  {
654
658
  style: {
655
- flex: 1,
659
+ flex: `${ratio.left || 6} 0`,
656
660
  display: "flex",
657
661
  flexDirection: "column",
658
662
  justifyContent: "center",
@@ -665,8 +669,7 @@ var SidedImageLayout = ({
665
669
  "div",
666
670
  {
667
671
  style: {
668
- flex: 1,
669
- maxWidth: "40vw",
672
+ flex: `${ratio.right || 4} 0`,
670
673
  display: "flex",
671
674
  flexDirection: "column",
672
675
  justifyContent: "center",
@@ -1615,7 +1618,6 @@ function Layout({
1615
1618
  }) {
1616
1619
  const layout = (frontmatter == null ? void 0 : frontmatter.layout) || "default";
1617
1620
  const Layout2 = layout in layouts_default ? layouts_default[layout] : null;
1618
- console.log(layout, Layout2);
1619
1621
  if (layout && !Layout2) {
1620
1622
  console.warn(`Layout ${layout} not found`);
1621
1623
  }
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
- export declare const SidedImageLayout: ({ children, image, position, height, }: {
2
+ export declare const SidedImageLayout: ({ children, image, position, height, ratio: ratioProp, }: {
3
3
  children: React.ReactNode;
4
4
  image?: string;
5
5
  position?: "left" | "right";
6
+ ratio?: string;
6
7
  height?: number;
7
8
  }) => React.JSX.Element;
@@ -13,10 +13,11 @@ declare const _default: {
13
13
  }) => import("react").JSX.Element;
14
14
  quote: typeof QuoteLayout;
15
15
  sidedCode: typeof SidedCodeLayout;
16
- sidedImage: ({ children, image, position, height, }: {
16
+ sidedImage: ({ children, image, position, height, ratio: ratioProp, }: {
17
17
  children: import("react").ReactNode;
18
18
  image?: string;
19
19
  position?: "left" | "right";
20
+ ratio?: string;
20
21
  height?: number;
21
22
  }) => import("react").JSX.Element;
22
23
  side: typeof SideLayout;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpichot/spectacle-deck",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.cjs",