-
-
-
-
- {children}
+
+
+
+
+
+
+
+
+ {children}
+
+
);
diff --git a/docs/src/components/Hero/SelectedLabel/styles.module.css b/docs/src/components/Hero/SelectedLabel/styles.module.css
index e699321122b8..a578b10f7364 100644
--- a/docs/src/components/Hero/SelectedLabel/styles.module.css
+++ b/docs/src/components/Hero/SelectedLabel/styles.module.css
@@ -5,44 +5,62 @@
.selection {
display: inline-block;
- padding: 2px 10px 8px;
+ position: absolute;
+ padding: 3px 10px 8px;
color: var(--swm-landing-heading-selected);
line-height: 1;
+ z-index: 1;
/* normally one would do this with border dashed but that doesn't allow for modifying spacing between dashes */
/* prettier-ignore */
background:
- linear-gradient(to right, var(--swm-landing-heading-selected-border) 50%, transparent 0%) top/var(--swm-dash-spacing) var(--swm-dash-width) repeat-x, /* top */
- linear-gradient(var(--swm-landing-heading-selected-border) 50%, transparent 0%) right/var(--swm-dash-width) var(--swm-dash-spacing) repeat-y, /* right */
- linear-gradient(to right, var(--swm-landing-heading-selected-border) 50%, transparent 0%) bottom/var(--swm-dash-spacing) var(--swm-dash-width) repeat-x, /* bottom */
- linear-gradient(var(--swm-landing-heading-selected-border) 50%, transparent 0%) left/var(--swm-dash-width) var(--swm-dash-spacing) repeat-y; /* left */
+ linear-gradient(to right, var(--swm-landing-heading-selected-border) 50%, transparent 0%) top/var(--swm-dash-spacing) var(--swm-dash-width) repeat-x,
+ /* top */
+ linear-gradient(var(--swm-landing-heading-selected-border) 50%, transparent 0%) right/var(--swm-dash-width) var(--swm-dash-spacing) repeat-y,
+ /* right */
+ linear-gradient(to right, var(--swm-landing-heading-selected-border) 50%, transparent 0%) bottom/var(--swm-dash-spacing) var(--swm-dash-width) repeat-x,
+ /* bottom */
+ linear-gradient(var(--swm-landing-heading-selected-border) 50%, transparent 0%) left/var(--swm-dash-width) var(--swm-dash-spacing) repeat-y;
+ /* left */
}
.selectionContainer {
position: relative;
+ text-align: center;
}
-.selectionBox {
- position: absolute;
- width: 12px;
- height: 12px;
-
- background: var(--swm-white);
- border: 2px solid var(--swm-landing-heading-selected-border);
+.headerText {
+ position: relative;
}
-.boxUpper {
- top: -6px;
+.interactiveHeaderText {
+ position: absolute;
+ transform: translate(-50%, -50%);
+ left: 50%;
+ top: 50%;
+ user-select: none;
}
-.boxLower {
- bottom: -14px;
+.preEnabledTextInteractivity {
+ margin-right: 24px;
}
-.boxLeft {
- left: -14px;
-}
+@media (max-width: 768px) {
+ :root {
+ --swm-dash-spacing: 20px;
+ }
+
+ .selection {
+ padding: 6px 2px 8px;
+ display: block;
+ margin: 6px 0;
+ }
+
+ .headerText {
+ margin: 0 10px;
+ }
-.boxRight {
- right: -14px;
+ .preInteractiveHeaderText {
+ margin-right: 0;
+ }
}
diff --git a/docs/src/components/Hero/SelectedLabel/utils.ts b/docs/src/components/Hero/SelectedLabel/utils.ts
new file mode 100644
index 000000000000..09ade9b2e3ec
--- /dev/null
+++ b/docs/src/components/Hero/SelectedLabel/utils.ts
@@ -0,0 +1,101 @@
+import { DraggableId } from './SelectionBox';
+
+export type DynamicStyles = {
+ top: number;
+ left: number;
+ width: number;
+ height: number;
+};
+
+export type StaticStyles = {
+ initialWidth: number;
+ initialHeight: number;
+ enabledTextInteractivity: boolean;
+};
+
+export type TextScaleStyles = {
+ x: number;
+ y: number;
+};
+
+export const computeSelectionStyles = (
+ position: { x: number; y: number },
+ draggableIdentifier: DraggableId,
+ dynamicStyles
+): DynamicStyles => {
+ const isLeft =
+ draggableIdentifier === DraggableId.BOTTOM_LEFT ||
+ draggableIdentifier === DraggableId.TOP_LEFT;
+ const isTop =
+ draggableIdentifier === DraggableId.TOP_LEFT ||
+ draggableIdentifier === DraggableId.TOP_RIGHT;
+ const isCenter = draggableIdentifier === DraggableId.CENTER;
+
+ // depedning on whether draggable is on left, right, top or bottom,
+ // we want to either resize, or move and resize our object
+ const positionAdjustment = {
+ x: isLeft ? position.x : 0,
+ y: isTop ? position.y : 0,
+ };
+
+ const sizeChange = {
+ x: isLeft ? -position.x : position.x,
+ y: isTop ? -position.y : position.y,
+ };
+
+ // adjust variables when dragging the center
+ if (isCenter) {
+ positionAdjustment.x = sizeChange.x;
+ positionAdjustment.y = sizeChange.y;
+ sizeChange.x = 0;
+ sizeChange.y = 0;
+ }
+
+ // stop overreduction in size
+ if (dynamicStyles.width + sizeChange.x < 0)
+ sizeChange.x = -dynamicStyles.width;
+ if (dynamicStyles.height + sizeChange.y < 0)
+ sizeChange.y = -dynamicStyles.height;
+
+ // stop dragging a minimized object
+ if (!isCenter) {
+ if (dynamicStyles.width - positionAdjustment.x < 0)
+ positionAdjustment.x = 0;
+ if (dynamicStyles.height - positionAdjustment.y < 0)
+ positionAdjustment.y = 0;
+ }
+
+ return {
+ left: dynamicStyles.left + positionAdjustment.x,
+ top: dynamicStyles.top + positionAdjustment.y,
+ width: dynamicStyles.width + sizeChange.x,
+ height: dynamicStyles.height + sizeChange.y,
+ };
+};
+
+export const computeTextStyles = (
+ dynamicStyles: DynamicStyles,
+ staticStyles: StaticStyles
+): TextScaleStyles => {
+ // these magic numbers are a result of disparity between font's apparent and actual size
+ const sizeOffsetX = 0.99;
+ const sizeOffsetY = 1.21;
+
+ // scale starts at 1 and as it gets larger approaches sizeOffset
+ const textScale = {
+ x:
+ (dynamicStyles.width / staticStyles.initialWidth) * sizeOffsetX -
+ sizeOffsetX +
+ 1,
+ y:
+ (dynamicStyles.height / staticStyles.initialHeight) * sizeOffsetY -
+ sizeOffsetY +
+ 1,
+ };
+
+ // prevent text overadjustment
+ if (textScale.x < 0) textScale.x = 0;
+ if (textScale.y < 0) textScale.y = 0;
+
+ return textScale;
+};
diff --git a/docs/src/components/Hero/StartScreen/index.tsx b/docs/src/components/Hero/StartScreen/index.tsx
index f3e01cf9ef4a..09f2960a3816 100644
--- a/docs/src/components/Hero/StartScreen/index.tsx
+++ b/docs/src/components/Hero/StartScreen/index.tsx
@@ -13,8 +13,8 @@ const StartScreen = () => {
- React Native
- Reanimated
+ React Native
+ Reanimated
Beyond the limitations
diff --git a/docs/src/components/Hero/StartScreen/styles.module.css b/docs/src/components/Hero/StartScreen/styles.module.css
index 5ee38fa5e4df..390e228545e3 100644
--- a/docs/src/components/Hero/StartScreen/styles.module.css
+++ b/docs/src/components/Hero/StartScreen/styles.module.css
@@ -26,8 +26,8 @@
color: var(--swm-landing-heading);
}
-.headingLabel span {
- margin-right: 8px;
+.rnLabel {
+ margin-right: 10px;
}
.subheadingLabel {
@@ -39,7 +39,7 @@
margin-top: 32px;
margin-bottom: 56px;
- width: 600px;
+ width: fit-content;
color: var(--swm-landing-heading);
}
@@ -101,10 +101,15 @@
flex-direction: column;
justify-content: space-between;
- margin-top: 64px;
+ margin-top: 22px;
height: 100%;
}
+ .subheadingLabel {
+ margin-top: 64px;
+ margin-bottom: 24px;
+ }
+
.foregroundLabel {
display: flex;
flex-direction: column;