Skip to content

Commit

Permalink
Merge pull request #169 from uselagoon/reposition_env_btn
Browse files Browse the repository at this point in the history
Repositioned Create Environment button
  • Loading branch information
tobybellwood authored Oct 4, 2023
2 parents 0be2150 + 7e4aa41 commit 6e26439
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/components/Environments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { makeSafe } from 'lib/util';
import * as R from 'ramda';

import { StyledEnvironments } from './StyledEnvironments';
import NewEnvironment from "../NewEnvironment";

const bgImages = {
branch: {
Expand All @@ -22,7 +23,7 @@ const bgImages = {
},
};

const Environments = ({ environments = [], project }) => {
const Environments = ({ environments = [], project, refresh, environmentCount }) => {
if (environments.length === 0) {
return null;
}
Expand Down Expand Up @@ -94,6 +95,7 @@ const Environments = ({ environments = [], project }) => {
</div>
);
})}
<NewEnvironment refresh={refresh} inputProjectName={project.name} productionEnvironment={project.productionEnvironment} environmentCount={environmentCount}/>
</StyledEnvironments>
);
};
Expand Down
38 changes: 38 additions & 0 deletions src/components/NewEnvironment/StyledNewEnvironment.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
import { bp, color, fontSize } from 'lib/variables';
import styled from 'styled-components';

export const StyledEnvironmentWrapper = styled.div`
width: 100%;
align-self: center;
margin-bottom: 35px;
@media ${bp.xs_smallUp} {
margin-left: 48px;
min-width: calc(50% - 24px);
width: calc(50% - 24px);
}
@media ${bp.xs_small} {
&:nth-child(2n + 1) {
margin-left: 0;
}
}
@media ${bp.tabletUp} {
margin-left: 0;
min-width: 100%;
width: 100%;
}
@media ${bp.desktopUp} {
margin-left: 48px;
min-width: calc(50% - 24px);
width: calc(50% - 24px);
}
@media ${bp.desktop_extrawide} {
&:nth-child(2n + 1) {
margin-left: 0;
}
}
@media ${bp.extraWideUp} {
min-width: calc((100% / 3) - 32px);
width: calc((100% / 3) - 32px);
&:nth-child(3n + 1) {
margin-left: 0;
}
}
`;

export const StyledNewEnvironment = styled.div`
.copy-field {
display: flex;
Expand Down
8 changes: 4 additions & 4 deletions src/components/NewEnvironment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import Image from "next/image";
import show from "../../static/images/show.svg";
import hide from "../../static/images/hide.svg";
import { CopyToClipboard } from "react-copy-to-clipboard";
import {StyledNewEnvironment} from './StyledNewEnvironment';
import {StyledNewEnvironment, StyledEnvironmentWrapper} from './StyledNewEnvironment';
import {useQuery} from "@apollo/react-hooks";
import ProjectByNameWithDeployKeyQuery from "../../lib/query/ProjectByNameWithDeployKey";
import { Footer, StyledNotificationWrapper } from '../Organizations/SharedStyles';
import { Footer } from '../Organizations/SharedStyles';
import getConfig from "next/config";
const { WEBHOOK_URL } = getConfig().publicRuntimeConfig;

Expand Down Expand Up @@ -78,7 +78,7 @@ const NewEnvironment = ({
}

return (
<StyledNotificationWrapper>
<StyledEnvironmentWrapper>
<div className="margins">
<Button action={openModal}>
<span style={{ display: 'inline-flex', alignItems: 'center', gap: '10px', padding: '0.25em' }}>
Expand Down Expand Up @@ -244,7 +244,7 @@ const NewEnvironment = ({
</Mutation>
</React.Fragment>
</Modal>
</StyledNotificationWrapper>
</StyledEnvironmentWrapper>
);
};

Expand Down
8 changes: 6 additions & 2 deletions src/pages/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ export const PageProject = ({ router }) => {
<ProjectDetailsSidebar project={project} />
</div>
<div className="environments-wrapper">
<NewEnvironment refresh={handleRefetch} inputProjectName={project.name} productionEnvironment={project.productionEnvironment} environmentCount={environmentCount}/>
<div className="environments-all">
<Environments environments={environments} project={project} />
<Environments environments={environments} project={project} refresh={handleRefetch} environmentCount={environmentCount}/>
{
environmentCount === 0 && (
<NewEnvironment inputProjectName={project.name} productionEnvironment={project.productionEnvironment} refresh={handleRefetch} environmentCount={environmentCount} />
)
}
</div>
</div>
</ProjectDetailsWrapper>
Expand Down

0 comments on commit 6e26439

Please sign in to comment.