Skip to content

Commit

Permalink
website: don't fix position initial clone popup
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezamirian committed Oct 25, 2024
1 parent d4572e5 commit 6fa9e58
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
19 changes: 17 additions & 2 deletions packages/example-app/src/ProjectInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
Button,
Popup,
ProgressBar,
styled,
} from "@intellij-platform/core";
import { StyledPopupContainer } from "@intellij-platform/core/Popup/Popup";

const defaultWorkspaceFiles = {
".idea/vcs.xml": `<?xml version="1.0" encoding="UTF-8"?>
Expand Down Expand Up @@ -73,6 +75,19 @@ const defaultInitializer = async () => {
);
};

/**
* Used instead of Popup to have it not be fixed positioned, since this popup
* is auto rendered in website's homepage, and example-app is rendered inline
* there.
*/
const InlinePopup = styled(StyledPopupContainer)<{ minWidth?: number }>`
min-width: ${({ minWidth }) => (minWidth ? `${minWidth}px` : "")};
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
`;

export const ProjectInitializer = ({
children,
autoCloneSampleRepo = false,
Expand Down Expand Up @@ -130,7 +145,7 @@ export const ProjectInitializer = ({
return <>{children}</>;
case "cloning":
return (
<Popup minWidth={450}>
<InlinePopup minWidth={450}>
<Popup.Layout
header="Cloning sample git repository"
content={
Expand All @@ -156,7 +171,7 @@ export const ProjectInitializer = ({
</div>
}
/>
</Popup>
</InlinePopup>
);
case "error":
return (
Expand Down
14 changes: 6 additions & 8 deletions packages/website/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useRef } from "react";
import clsx from "clsx";
import Layout from "@theme/Layout";
import Link from "@docusaurus/Link";
Expand All @@ -7,7 +7,7 @@ import styles from "./_index/index.module.css";
import HomepageFeatures from "./_index/HomepageFeatures";
import { WindowFrame } from "./_index/WindowFrame/WindowFrame";
import { LazyExampleApp } from "../components/LazyExampleApp";
import styled from "styled-components";
import { styled } from "@intellij-platform/core";
import {
PageSection2,
PageSection2 as SectionType,
Expand Down Expand Up @@ -107,12 +107,9 @@ export default function Home(): JSX.Element {
JUI offers, rather than being a real IDE.
</SectionType.Subtitle>
</PageSection2.Container>
<ExampleWindowFrame>
<LazyExampleApp
height="calc(100vh - 200px)"
autoCloneSampleRepo
/>
</ExampleWindowFrame>
<LazyExampleApp height="calc(100vh - 200px)" autoCloneSampleRepo>
{(app) => <ExampleWindowFrame>{app}</ExampleWindowFrame>}
</LazyExampleApp>
</PageSection2>
</main>
</Layout>
Expand All @@ -124,4 +121,5 @@ const ExampleWindowFrame = styled(WindowFrame)`
margin-top: 2rem;
width: clamp(85%, 1200px, calc(100vw - 1rem));
min-height: calc(100vh - 200px);
background: ${({ theme }) => theme.commonColors.panelBackground};
`;

0 comments on commit 6fa9e58

Please sign in to comment.