Browse Source

Added expand action

jnfrati 4 years ago
parent
commit
c8cd9536e2
1 changed files with 17 additions and 11 deletions
  1. 17 11
      dashboard/src/main/home/launch/launch-flow/WorkflowPage.tsx

+ 17 - 11
dashboard/src/main/home/launch/launch-flow/WorkflowPage.tsx

@@ -1,5 +1,4 @@
 import React, { useContext, useEffect, useState } from "react";
 import React, { useContext, useEffect, useState } from "react";
-import { RouteComponentProps } from "react-router";
 import { FullActionConfigType } from "../../../../shared/types";
 import { FullActionConfigType } from "../../../../shared/types";
 import api from "../../../../shared/api";
 import api from "../../../../shared/api";
 import { Context } from "../../../../shared/Context";
 import { Context } from "../../../../shared/Context";
@@ -7,9 +6,6 @@ import styled from "styled-components";
 import YamlEditor from "../../../../components/YamlEditor";
 import YamlEditor from "../../../../components/YamlEditor";
 import Loading from "../../../../components/Loading";
 import Loading from "../../../../components/Loading";
 import Helper from "../../../../components/form-components/Helper";
 import Helper from "../../../../components/form-components/Helper";
-import CheckboxRow from "../../../../components/form-components/CheckboxRow";
-import SaveButton from "../../../../components/SaveButton";
-import yaml from "js-yaml";
 
 
 type PropsType = {
 type PropsType = {
   name: string;
   name: string;
@@ -60,7 +56,7 @@ const WorkflowPage: React.FC<PropsType> = (props) => {
         </Placeholder>
         </Placeholder>
       );
       );
     }
     }
-    return <YamlEditor value={workflowYAML} readOnly={true} />;
+    return <AnimatedYamlEditor value={workflowYAML} readOnly={true} />;
   };
   };
 
 
   return (
   return (
@@ -70,7 +66,13 @@ const WorkflowPage: React.FC<PropsType> = (props) => {
         To auto-deploy each time you push changes, Porter will write GitHub
         To auto-deploy each time you push changes, Porter will write GitHub
         Secrets and this GitHub Actions workflow to your repository.
         Secrets and this GitHub Actions workflow to your repository.
       </Helper>
       </Helper>
-      {renderWorkflow()}
+      <ExpandableButton onClick={() => setIsExpanded((prev) => !prev)}>
+        Show porter workflow{" "}
+        <i className="material-icons-outlined">
+          {isExpanded ? "keyboard_arrow_up" : "keyboard_arrow_down"}
+        </i>
+      </ExpandableButton>
+      {isExpanded && renderWorkflow()}
       <Helper>
       <Helper>
         <GitHubActionLink show={!props.shouldCreateWorkflow}>
         <GitHubActionLink show={!props.shouldCreateWorkflow}>
           If you want to create a custom workflow file for your deployments, we
           If you want to create a custom workflow file for your deployments, we
@@ -138,19 +140,20 @@ const Buffer = styled.div`
   height: 35px;
   height: 35px;
 `;
 `;
 
 
-const BackButton = styled.div`
+const ExpandableButton = styled.div`
+  position: relative;
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;
   justify-content: space-between;
   justify-content: space-between;
   cursor: pointer;
   cursor: pointer;
   font-size: 13px;
   font-size: 13px;
   margin-top: 25px;
   margin-top: 25px;
-  height: 35px;
+  height: 40px;
   padding: 5px 13px;
   padding: 5px 13px;
   padding-right: 15px;
   padding-right: 15px;
   border: 1px solid #ffffff55;
   border: 1px solid #ffffff55;
-  border-radius: 100px;
-  width: ${(props: { width: string }) => props.width};
+  border-radius: 5px;
+  width: 100%;
   color: white;
   color: white;
   background: #ffffff11;
   background: #ffffff11;
 
 
@@ -160,12 +163,15 @@ const BackButton = styled.div`
 
 
   > i {
   > i {
     color: white;
     color: white;
-    font-size: 16px;
+    font-size: 24px;
     margin-right: 6px;
     margin-right: 6px;
     margin-left: -2px;
     margin-left: -2px;
   }
   }
 `;
 `;
 
 
+// This should carry animations for the yaml editor to be more gently introduce into the page
+const AnimatedYamlEditor = styled(YamlEditor)``;
+
 const GitHubActionLink = styled.p`
 const GitHubActionLink = styled.p`
   visibility: ${(props: { show: boolean }) =>
   visibility: ${(props: { show: boolean }) =>
     props.show ? "visible" : "hidden"};
     props.show ? "visible" : "hidden"};