Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Styles conflicts on shared components #159

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/AddVariable/StyledAddVariable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const NewVariable = styled.div`
.add-var-btn {
margin-top: 16px;
}
button.icon {
padding: 0 10px;
}
`;

export const NewVariableModal = styled.div`
Expand Down
8 changes: 7 additions & 1 deletion src/components/DeleteVariable/StyledDeleteVariable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@ export const DeleteVariableModal = styled.div`
}
.deleteConfirmImg span {
cursor: pointer;
}
}
`;

export const DeleteVariableButton = styled.div`
button.icon {
padding: 0 10px;
}
`;
24 changes: 13 additions & 11 deletions src/components/DeleteVariable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ButtonBootstrap from "react-bootstrap/Button";
import Button from 'components/Button'
import { Mutation } from "react-apollo";
import withLogic from "components/AddVariable/logic";
import {DeleteVariableModal} from "./StyledDeleteVariable";
import {DeleteVariableModal, DeleteVariableButton} from "./StyledDeleteVariable";
import DeleteEnvVariableMutation from "../../lib/mutation/deleteEnvVariableByName";

/**
Expand All @@ -27,16 +27,18 @@ export const DeleteVariable = ({
}) => {
return (
<React.Fragment>
{
icon ?
<Button variant='red' icon={icon} action={openModal}>
Delete
</Button>
:
<Button variant='red' action={openModal}>
Delete
</Button>
}
<DeleteVariableButton>
{
icon ?
<Button variant='red' icon={icon} action={openModal}>
Delete
</Button>
:
<Button variant='red' action={openModal}>
Delete
</Button>
}
</DeleteVariableButton>
<Modal
isOpen={open}
onRequestClose={closeModal}
Expand Down
50 changes: 43 additions & 7 deletions src/components/EnvironmentVariables/StyledEnvironmentVariables.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import styled from "styled-components";
import { bp, color } from "lib/variables";

export const VariableActions = styled.div`
display: flex;
gap: 10px;
justify-content: space-evenly;
> * {
display: flex;
align-items: center;
justify-content: center;
}
`;

export const StyledEnvironmentVariableDetails = styled.div`
padding: 32px calc((100vw / 16) * 1);
width: 100%;
Expand Down Expand Up @@ -267,10 +278,20 @@ export const StyledVariableTable = styled.div`
& .varUpdate {
display: flex;
padding: 0;
width: 10%;

button {
background-color: #fff;
}
}
& .varDelete {
width: 10%;
& .varActions {
width: 20%;
display: flex;
align-items: center;

&:last-child {
justify-content: flex-end;
-webkit-box-pack: end;
}
}
}

Expand Down Expand Up @@ -308,8 +329,17 @@ export const StyledVariableTable = styled.div`
& .varScope {
width: 30%;
}
& .varDelete {
& .varActions {
width: 10%;
display: flex;

&:last-child {
justify-content: flex-end;
-webkit-box-pack: end;
}
}
& .varDelete {
padding-right: 10px;
}

&.skeleton {
Expand Down Expand Up @@ -500,8 +530,14 @@ export const StyledProjectVariableTable = styled.div`
& .varName {
padding-left: 20px;
}
& .varDelete {
width: 5%;
& .varActions {
width: 10%;
display: flex;

&:last-child {
justify-content: flex-end;
-webkit-box-pack: end;
}
}

&.skeleton {
Expand All @@ -526,4 +562,4 @@ export const StyledProjectVariableTable = styled.div`
display: none;
transition: unset;
}
`;
`;
63 changes: 34 additions & 29 deletions src/components/EnvironmentVariables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
StyledEnvironmentVariableDetails,
StyledProjectVariableTable,
StyledVariableTable,
VariableActions,
} from "./StyledEnvironmentVariables";
import Image from "next/image";
import show from "../../static/images/show.svg";
Expand Down Expand Up @@ -267,35 +268,39 @@ const EnvironmentVariables = ({ environment, onVariableAdded, closeModal }) => {
</div>
</Collapse>
)}
<Collapse in={openEnvVars}>
<div className="varUpdate">
<Button
onClick={() => setUpdateValue(envVar.value, envVar.name, envVar.scope)}
style={{ all: 'unset'}}
>
<AddVariable
varProject={environment.project.name}
varEnvironment={environment.name}
varValues={displayVars}
varTarget="Environment"
varName={updateVarName}
varValue={updateVarValue}
varScope={updateVarScope}
refresh={onVariableAdded}
icon="edit"
/>
</Button>
</div>
</Collapse>
<div className="varDelete">
<DeleteVariable
deleteType="Environment variable"
deleteName={envVar.name}
varProject={environment.project.name}
varEnvironment={environment.name}
icon="bin"
refresh={onVariableAdded}
/>
<div className="varActions">
<VariableActions>
<Collapse in={openEnvVars}>
<div className="varUpdate">
<Button
onClick={() => setUpdateValue(envVar.value, envVar.name, envVar.scope)}
style={{ all: 'unset'}}
>
<AddVariable
varProject={environment.project.name}
varEnvironment={environment.name}
varValues={displayVars}
varTarget="Environment"
varName={updateVarName}
varValue={updateVarValue}
varScope={updateVarScope}
refresh={onVariableAdded}
icon="edit"
/>
</Button>
</div>
</Collapse>
<div className="varDelete">
<DeleteVariable
deleteType="Environment variable"
deleteName={envVar.name}
varProject={environment.project.name}
varEnvironment={environment.name}
icon="bin"
refresh={onVariableAdded}
/>
</div>
</VariableActions>
</div>
</div>
</Fragment>
Expand Down
38 changes: 34 additions & 4 deletions src/components/ProjectVariables/StyledProjectVariables.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import styled from "styled-components";
import { bp, color } from "lib/variables";

export const VariableActions = styled.div`
display: flex;
gap: 10px;
justify-content: space-evenly;
> * {
display: flex;
align-items: center;
justify-content: center;
}
`;

export const StyledProjectVariablesDetails = styled.div`
padding: 32px calc((100vw / 16) * 1);
width: 100%;
Expand Down Expand Up @@ -261,10 +272,20 @@ export const StyledProjectVariableTable = styled.div`
& .varUpdate {
display: flex;
padding: 0;
width: 10%;

button {
background-color: #fff;
}
}
& .varDelete {
width: 10%;
& .varActions {
width: 20%;
display: flex;
align-items: center;

&:last-child {
justify-content: flex-end;
-webkit-box-pack: end;
}
}
}

Expand Down Expand Up @@ -302,8 +323,17 @@ export const StyledProjectVariableTable = styled.div`
& .varScope {
width: 30%;
}
& .varDelete {
& .varActions {
width: 10%;
display: flex;

&:last-child {
justify-content: flex-end;
-webkit-box-pack: end;
}
}
& .varDelete {
padding-right: 10px;
}

&.skeleton {
Expand Down
53 changes: 29 additions & 24 deletions src/components/ProjectVariables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import hide from "../../static/images/hide.svg";
import {
StyledProjectVariablesDetails,
StyledProjectVariableTable,
VariableActions,
} from "./StyledProjectVariables";
import DeleteVariable from "components/DeleteVariable";

Expand Down Expand Up @@ -233,33 +234,37 @@ const ProjectVariables = ({ project, onVariableAdded, closeModal }) => {
</div>
</Collapse>
)}
<Collapse in={openPrjVars}>
<div className="varUpdate">
<Button
onClick={() => setUpdateValue(projEnvVar.value, projEnvVar.name, projEnvVar.scope)}
style={{ all: 'unset'}}
>
<AddVariable
<div className="varActions">
<VariableActions>
<Collapse in={openPrjVars}>
<div className="varUpdate">
<Button
onClick={() => setUpdateValue(projEnvVar.value, projEnvVar.name, projEnvVar.scope)}
style={{ all: 'unset'}}
>
<AddVariable
varProject={project.name}
varValues={displayVars}
varTarget="Project"
varName={updateVarName}
varValue={updateVarValue}
varScope={updateVarScope}
refresh={onVariableAdded}
icon="edit"
/>
</Button>
</div>
</Collapse>
<div className="varDelete">
<DeleteVariable
deleteType="Project variable"
deleteName={projEnvVar.name}
varProject={project.name}
varValues={displayVars}
varTarget="Project"
varName={updateVarName}
varValue={updateVarValue}
varScope={updateVarScope}
icon="bin"
refresh={onVariableAdded}
icon="edit"
/>
</Button>
</div>
</Collapse>
<div className="varDelete">
<DeleteVariable
deleteType="Project variable"
deleteName={projEnvVar.name}
varProject={project.name}
icon="bin"
refresh={onVariableAdded}
/>
</div>
</VariableActions>
</div>
</div>
</Fragment>
Expand Down