فهرست منبع

pr-preview fe styling

portersupport 4 سال پیش
والد
کامیت
a3b81b9555

+ 2 - 2
dashboard/src/main/home/cluster-dashboard/dashboard/Dashboard.tsx

@@ -28,7 +28,7 @@ const tabOptions: {
   label: string;
   value: TabEnum;
 }[] = [
-  { label: "PR preview", value: "preview_environments" },
+  { label: "PR Preview", value: "preview_environments" },
   { label: "Nodes", value: "nodes" },
   { label: "Events", value: "events" },
   { label: "Metrics", value: "metrics" },
@@ -153,7 +153,7 @@ const InfoLabel = styled.div`
 `;
 
 const InfoSection = styled.div`
-  margin-top: 20px;
+  margin-top: 36px;
   font-family: "Work Sans", sans-serif;
   margin-left: 0px;
   margin-bottom: 35px;

+ 86 - 36
dashboard/src/main/home/cluster-dashboard/dashboard/preview-environments/EnvironmentDetail.tsx

@@ -6,9 +6,11 @@ import pr_icon from "assets/pull_request_icon.svg";
 import { useRouteMatch } from "react-router";
 import DynamicLink from "components/DynamicLink";
 import { capitalize, Environment } from "./EnvironmentList";
+import Loading from "components/Loading";
 import { Context } from "shared/Context";
 import api from "shared/api";
 import ChartList from "../../chart/ChartList";
+import github from "assets/github-white.png";
 
 const mockEnvironment = {
   id: 1,
@@ -42,7 +44,7 @@ const EnvironmentDetail = () => {
   }, [params]);
 
   if (!environment) {
-    return <>Loading . . .</>;
+    return <Loading />;
   }
 
   return (
@@ -51,50 +53,94 @@ const EnvironmentDetail = () => {
         <BackButton to={"/cluster-dashboard?selected_tab=preview_environments"}>
           <BackButtonImg src={backArrow} />
         </BackButton>
-        <Title icon={pr_icon} iconWidth="30px">
+        <Title icon={pr_icon} iconWidth="25px">
           {environment.url}
-          <DynamicLink to={environment.url} target="_blank">
-            <i className="material-icons">link</i>
-          </DynamicLink>
           <TagWrapper>
             Namespace <NamespaceTag>{environment.namespace}</NamespaceTag>
           </TagWrapper>
         </Title>
-        <br />
         <InfoWrapper>
-          <PrLinkWrapper>
-            Link to PR:
-            <PRLink to={environment.pr_link} target="_blank">
-              {environment.pr_link}
-            </PRLink>
-          </PrLinkWrapper>
+          <PRLink to={environment.pr_link} target="_blank">
+            <i className="material-icons">link</i>
+            {environment.pr_link}
+          </PRLink>
+        </InfoWrapper>
+        <Flex>
           <Status>
             <StatusDot status={environment.status} />
             {capitalize(environment.status)}
           </Status>
-        </InfoWrapper>
+          <Dot>•</Dot>
+          <GHALink to={environment.actions_link} target="_blank">
+            <img src={github} /> GitHub Action
+            <i className="material-icons">
+              open_in_new
+            </i>
+          </GHALink>
+        </Flex>
+        <LinkToActionsWrapper>
+      </LinkToActionsWrapper>
       </HeaderWrapper>
-      <br />
+      <LineBreak />
       <ChartListWrapper>
         <ChartList
           currentCluster={context.currentCluster}
           currentView="cluster-dashboard"
-          sortType="Newest"
+          sortType="Newest" 
           namespace={environment.namespace}
           disableBottomPadding
         />
       </ChartListWrapper>
-      <LinkToActionsWrapper>
-        <DynamicLink to={environment.actions_link}>
-          Link to Actions tab
-        </DynamicLink>
-      </LinkToActionsWrapper>
     </StyledExpandedChart>
   );
 };
 
 export default EnvironmentDetail;
 
+const Flex = styled.div`
+  display: flex;
+  align-items: center;
+  margin-top: 20px;
+`;
+
+const GHALink = styled(DynamicLink)`
+  font-size: 13px;
+  font-weight: 400;
+  margin-left: 7px;
+  color: #aaaabb;
+  display: flex;
+  align-items: center;
+
+  :hover {
+    text-decoration: underline;
+    color: white;
+  }
+
+  > img {
+    height: 16px;
+    margin-right: 9px;
+    margin-left: 5px;
+
+    :text-decoration: none;
+    :hover {
+      text-decoration: underline;
+      color: white;
+    }
+  }
+
+  > i {
+    margin-left: 7px;
+    font-size: 17px;
+  }
+`;
+
+const LineBreak = styled.div`
+  width: calc(100% - 0px);
+  height: 2px;
+  background: #ffffff20;
+  margin-bottom: 20px;
+`;
+
 const BackButton = styled(DynamicLink)`
   position: absolute;
   top: 0px;
@@ -127,29 +173,23 @@ const HeaderWrapper = styled.div`
 `;
 
 const Dot = styled.div`
-  margin-right: 9px;
+  margin-left: 9px;
+  font-size: 14px;
+  color: #ffffff33;
 `;
 
 const InfoWrapper = styled.div`
   display: flex;
   align-items: center;
-  margin-top: 22px;
   width: auto;
   justify-content: space-between;
 `;
 
-const PrLinkWrapper = styled.div`
-  font-size: 14px;
-  display: flex;
-  align-items: center;
-  color: #aaaabb66;
-`;
-
 const TagWrapper = styled.div`
   height: 20px;
   font-size: 12px;
   display: flex;
-  margin-left: 15px;
+  margin-left: 20px;
   margin-bottom: -3px;
   align-items: center;
   font-weight: 400;
@@ -183,7 +223,6 @@ const Icon = styled.img`
 
 const StyledExpandedChart = styled.div`
   width: 100%;
-  overflow: hidden;
   z-index: 0;
   animation: fadeIn 0.3s;
   animation-timing-function: ease-out;
@@ -203,12 +242,14 @@ const StyledExpandedChart = styled.div`
 
 const Title = styled(TitleSection)`
   font-size: 16px;
+  margin-top: 4px;
 `;
 
 const Status = styled.span`
-  font-size: 14px;
+  font-size: 13px;
   display: flex;
   align-items: center;
+  margin-left: 1px;
   min-height: 17px;
   color: #a7a6bb;
 `;
@@ -226,23 +267,32 @@ const StatusDot = styled.div`
       : "#f5cb42"};
   border-radius: 20px;
   margin-left: 3px;
-  margin-right: 5px;
+  margin-right: 15px;
 `;
 
 const PRLink = styled(DynamicLink)`
-  margin-left: 5px;
+  margin-left: 0px;
+  display: flex;
+  margin-top: 1px;
+  align-items: center;
+  font-size: 13px;
+  > i {
+    font-size: 15px;
+    margin-right: 10px;
+  }
 `;
 
 const ChartListWrapper = styled.div`
-  width: 95%;
+  width: 100%;
   margin: auto;
   margin-top: 20px;
+  padding-bottom: 125px;
 `;
 
 const LinkToActionsWrapper = styled.div`
   width: 100%;
   margin-top: 15px;
-  margin-bottom: 30px;
+  margin-bottom: 25px;
   display: flex;
   align-items: center;
   justify-content: center;

+ 89 - 47
dashboard/src/main/home/cluster-dashboard/dashboard/preview-environments/EnvironmentList.tsx

@@ -6,6 +6,7 @@ import styled from "styled-components";
 import SortSelector from "../../SortSelector";
 import ButtonEnablePREnvironments from "./components/ButtonEnablePREnvironments";
 import ConnectNewRepo from "./components/ConnectNewRepo";
+import Loading from "components/Loading";
 import pr_icon from "assets/pull_request_icon.svg";
 
 export type Environment = {
@@ -128,7 +129,7 @@ const EnvironmentList = () => {
   }
 
   if (isLoading) {
-    return <>Loading . . .</>;
+    return <Placeholder><Loading /></Placeholder>;
   }
 
   if (hasError) {
@@ -150,7 +151,7 @@ const EnvironmentList = () => {
           to={`${currentUrl}?selected_tab=preview_environments&action=connect-repo`}
           onClick={() => console.log("launch repo")}
         >
-          <i className="material-icons">add</i> Add repository
+          <i className="material-icons">add</i> Add Repository
         </Button>
         <SortFilterWrapper>
           {/* <SortSelector
@@ -162,23 +163,32 @@ const EnvironmentList = () => {
       <EventsGrid>
         {environmentList.map((env) => {
           return (
-            <EnvironmentCard
-              to={`${currentUrl}/pr-env-detail/${env.id}`}
-              key={env.pr_link}
-            >
-              <DataAndIconContainer>
-                <PRIcon src={pr_icon} alt="pull request icon" />
-                <DataContainer>
-                  <DataPRUrl>URL: {env.url}</DataPRUrl>
-                  <DataPRLink>PR Link: {env.pr_link}</DataPRLink>
-                </DataContainer>
-              </DataAndIconContainer>
-              <StatusContainer>
-                <Status>
-                  <StatusDot status={env.status} />
-                  {capitalize(env.status)}
-                </Status>
-              </StatusContainer>
+            <EnvironmentCard>
+              <DataContainer>
+                <PRName>
+                  <PRIcon src={pr_icon} alt="pull request icon" />
+                  {env.url}
+                </PRName>
+                <StatusContainer>
+                  <Status>
+                    <StatusDot status={env.status} />
+                    {capitalize(env.status)}
+                  </Status>
+                </StatusContainer>
+              </DataContainer>
+              <Flex>
+                <RowButton
+                  to={`${currentUrl}/pr-env-detail/${env.id}`}
+                  key={env.pr_link}
+                >
+                  <i className="material-icons-outlined">info</i>
+                  Details
+                </RowButton>
+                <RowButton to={env.pr_link} target="_blank">
+                  <i className="material-icons">open_in_new</i>
+                  View Live
+                </RowButton>
+              </Flex>
             </EnvironmentCard>
           );
         })}
@@ -189,8 +199,33 @@ const EnvironmentList = () => {
 
 export default EnvironmentList;
 
+const Placeholder = styled.div`
+  height: 300px;
+`;
+
+const Flex = styled.div`
+  display: flex;
+  align-items: center;
+`;
+
+const Helper = styled.span`
+  text-transform: capitalize;
+  color: #ffffff44;
+  margin-right: 5px;
+`;
+
+const PRName = styled.div`
+  font-family: "Work Sans", sans-serif;
+  font-weight: 500;
+  color: #ffffff;
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+`;
+
 const Container = styled.div`
-  margin-top: 30px;
+  margin-top: 33px;
+  padding-bottom: 120px;
 `;
 
 const ControlRow = styled.div`
@@ -254,19 +289,19 @@ const SortFilterWrapper = styled.div`
   }
 `;
 
-const EnvironmentCard = styled(DynamicLink)`
-  background: #26282f;
-  min-height: 90px;
-  width: 100%;
+const EnvironmentCard = styled.div`
   display: flex;
-  justify-content: space-between;
   align-items: center;
-  border: 1px solid #26282f;
-  box-shadow: 0 4px 15px 0px #00000055;
-  border-radius: 8px;
-  padding: 20px;
-
-  animation: fadeIn 0.8s;
+  justify-content: space-between;
+  border: 1px solid #ffffff44;
+  background: #ffffff08;
+  margin-bottom: 5px;
+  border-radius: 10px;
+  padding: 14px;
+  overflow: hidden;
+  height: 80px;
+  font-size: 13px;
+  animation: fadeIn 0.5s;
   @keyframes fadeIn {
     from {
       opacity: 0;
@@ -275,13 +310,6 @@ const EnvironmentCard = styled(DynamicLink)`
       opacity: 1;
     }
   }
-
-  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
-  :hover {
-    transform: scale(1.025);
-    box-shadow: 0 8px 20px 0px #00000030;
-    cursor: pointer;
-  }
 `;
 
 const EventsGrid = styled.div`
@@ -310,22 +338,36 @@ const DataPRUrl = styled.span`
 `;
 
 const PRIcon = styled.img`
-  width: 25px;
+  font-size: 20px;
+  height: 17px;
   margin-right: 10px;
+  color: #aaaabb;
+  opacity: 50%;
 `;
 
-const DataAndIconContainer = styled.div`
+const RowButton = styled(DynamicLink)`
+  font-size: 12px;
+  padding: 8px 10px;
+  margin-left: 10px;
+  border-radius: 5px;
+  color: #ffffff;
+  border: 1px solid #aaaabb;
   display: flex;
-  height: 100%;
-`;
+  align-items: center;
+  background: #ffffff08;
 
-const DataPRLink = styled.span`
-  font-size: 14px;
-  color: #a7a6bb;
+  :hover {
+    background: #ffffff22;
+  }
+
+  > i {
+    font-size: 14px;
+    margin-right: 8px;
+  }
 `;
 
 const Status = styled.span`
-  font-size: 14px;
+  font-size: 13px;
   display: flex;
   align-items: center;
   min-height: 17px;
@@ -335,6 +377,7 @@ const Status = styled.span`
 const StatusDot = styled.div`
   width: 8px;
   height: 8px;
+  margin-right: 15px;
   background: ${(props: { status: string }) =>
     props.status === "deployed"
       ? "#4797ff"
@@ -345,5 +388,4 @@ const StatusDot = styled.div`
       : "#f5cb42"};
   border-radius: 20px;
   margin-left: 3px;
-  margin-right: 5px;
 `;