Skip to content

Commit

Permalink
style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
gabalafou committed Apr 23, 2024
1 parent ba1059d commit ce6bdea
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 30 deletions.
14 changes: 8 additions & 6 deletions src/features/channels/components/ChannelsEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
StyledAccordionDetails,
StyledAccordionSummary,
StyledAccordionTitle,
StyledButtonPrimary
StyledButtonSecondary
} from "../../../styles";
import { reorderArray } from "../../../utils/helpers";
import { ArrowIcon } from "../../../components";
Expand All @@ -27,11 +27,13 @@ export interface IChannelsEditProps {
*/
channelsList: string[];
updateChannels: (channels: string[]) => void;
maxWidth?: number;
}

const BaseChannelsEdit = ({
channelsList,
updateChannels
updateChannels,
maxWidth = 420
}: IChannelsEditProps) => {
const listLength = channelsList.length;
const { palette } = useTheme();
Expand Down Expand Up @@ -73,7 +75,7 @@ const BaseChannelsEdit = ({
return (
<Accordion
defaultExpanded={expandedRef.current}
sx={{ maxWidth: 420, boxShadow: "none" }}
sx={{ maxWidth, boxShadow: "none" }}
disableGutters
>
<StyledAccordionSummary expandIcon={<ArrowIcon />}>
Expand Down Expand Up @@ -134,15 +136,15 @@ const BaseChannelsEdit = ({
borderRadius: "0px",
padding: "15px 21px",
display: "flex",
justifyContent: "center"
justifyContent: "flex-start"
}}
>
<StyledButtonPrimary
<StyledButtonSecondary
variant="contained"
onClick={() => setIsAdding(true)}
>
+ Add Channel
</StyledButtonPrimary>
</StyledButtonSecondary>
</AccordionDetails>
</Accordion>
);
Expand Down
20 changes: 15 additions & 5 deletions src/features/dependencies/components/Dependencies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ export interface IDependenciesProps {
mode: "read-only" | "edit";
hasMore: boolean;
next?: () => void;
maxWidth?: number;
}

export const Dependencies = ({
mode,
dependencies,
hasMore,
next = () => null
next = () => null,
maxWidth = 420
}: IDependenciesProps) => {
const dispatch = useAppDispatch();
const { selectedEnvironment } = useAppSelector(state => state.tabs);
Expand All @@ -53,15 +55,15 @@ export const Dependencies = ({
return (
<Accordion
sx={{
maxWidth: 420,
maxWidth,
boxShadow: "none"
}}
disableGutters
defaultExpanded
>
<StyledAccordionSummary expandIcon={<ArrowIcon />}>
<StyledAccordionTitle sx={{ color: "primary.main" }}>
Packages Installed{" "}
Installed Packages{" "}
<Tooltip title="Includes requested packages and their dependencies">
<InfoOutlinedIcon
sx={{
Expand Down Expand Up @@ -98,7 +100,7 @@ export const Dependencies = ({
>
{dependencies.length ? (
<TableContainer>
<Table sx={{ width: "420px", tableLayout: "fixed" }}>
<Table sx={{ width: "100%", tableLayout: "fixed" }}>
<TableHead>
<TableRow>
<TableCell sx={{ fontSize: "13px" }}>Package</TableCell>
Expand Down Expand Up @@ -130,7 +132,15 @@ export const Dependencies = ({
</Table>
</TableContainer>
) : (
<CircularProgress size={20} />
<Box
sx={{
display: "flex",
justifyContent: "center",
padding: "10px"
}}
>
<CircularProgress size={20} />
</Box>
)}
</InfiniteScroll>
</StyledAccordionDetails>
Expand Down
24 changes: 14 additions & 10 deletions src/features/dependencies/components/DependenciesItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,25 @@ const BaseDependenciesItem = ({
<Typography
sx={{
color: "#333",
width: isEditMode ? "140px" : "auto",
marginLeft: isEditMode ? "20px" : "0px",
fontSize: "13px"
}}
>
{version}
{isEditMode && (
<Tooltip
title="Promote as requested package"
placement="right-start"
>
<StyledIconButton onClick={handleClick} data-testid="PromoteIcon">
<UploadIcon />
</StyledIconButton>
</Tooltip>
<>
&nbsp;
<Tooltip
title="Promote as requested package"
placement="right-start"
>
<StyledIconButton
onClick={handleClick}
data-testid="PromoteIcon"
>
<UploadIcon />
</StyledIconButton>
</Tooltip>
</>
)}
</Typography>
</TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
StyledAccordionDetails,
StyledAccordionSummary,
StyledAccordionTitle,
StyledButtonPrimary,
StyledButtonSecondary,
StyledEditPackagesTableCell
} from "../../../styles";
import { AddRequestedPackage } from "../../requestedPackages";
Expand Down Expand Up @@ -118,15 +118,15 @@ export const CreateEnvironmentPackages = ({
borderRadius: "0px 0px 5px 5px",
padding: "15px 21px",
display: "flex",
justifyContent: "center"
justifyContent: "flex-start"
}}
>
<StyledButtonPrimary
<StyledButtonSecondary
variant="contained"
onClick={() => setIsAdding(true)}
>
+ Add Package
</StyledButtonPrimary>
</StyledButtonSecondary>
</AccordionDetails>
</Accordion>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,14 @@ export const SpecificationEdit = ({
dependencies={dependencies}
hasMore={hasMore}
next={() => dispatch(pageChanged(page + 1))}
maxWidth={500}
/>
</Box>
<Box sx={{ margiBottom: "30px" }}>
<ChannelsEdit
channelsList={channels}
updateChannels={onUpdateChannels}
maxWidth={500}
/>
</Box>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
StyledAccordionDetails,
StyledAccordionSummary,
StyledAccordionTitle,
StyledButtonPrimary,
StyledButtonSecondary,
StyledEditPackagesTableCell
} from "../../../styles";
import { CondaSpecificationPip } from "../../../common/models";
Expand Down Expand Up @@ -139,15 +139,15 @@ export const RequestedPackagesEdit = ({
borderRadius: "0px",
padding: "15px 21px",
display: "flex",
justifyContent: "center"
justifyContent: "flex-start"
}}
>
<StyledButtonPrimary
<StyledButtonSecondary
variant="contained"
onClick={() => setIsAdding(true)}
>
+ Add Package
</StyledButtonPrimary>
</StyledButtonSecondary>
</AccordionDetails>
</Accordion>
);
Expand Down
35 changes: 35 additions & 0 deletions src/styles/StyledButtonSecondary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import Button from "@mui/material/Button";
import { styled } from "@mui/system";

export const StyledButtonSecondary = styled(Button, {
shouldForwardProp: prop => prop !== "styleType"
})<{ styleType?: string }>(({ theme: { palette } }) => ({
padding: "4px 12px 4px 12px",
border: palette.secondary.main,
fontSize: "14px",
color: palette.secondary.contrastText,
textTransform: "none",
backgroundColor: palette.secondary.main,
boxShadow: "none",
borderRadius: "4px",
gap: "6px",
":hover": {
boxShadow: "none",
color: palette.secondary.contrastText,
backgroundColor: palette.secondary.dark,
textDecoration: "underline",
textUnderlineOffset: "0.3em"
},
"&:focus": {
outlineColor: palette.secondary.main,
outlineStyle: "auto",
outlineOffset: "4px",
outlineWidth: "medium",
transition: "none"
},
"&:disabled": {
backgroundColor: palette.secondary[100],
border: "none",
color: palette.secondary.light
}
}));
1 change: 1 addition & 0 deletions src/styles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from "./StyledAccordionDetails";
export * from "./StyledAccordionTitle";
export * from "./StyledEditPackagesTableCell";
export * from "./StyledButtonPrimary";
export * from "./StyledButtonSecondary";
export * from "./StyledRequestedPackagesTableCell";
export * from "./StyledIconButton";
export * from "./StyledAccordionExpandIcon";
Expand Down
2 changes: 1 addition & 1 deletion test/dependencies/Dependencies.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("<Dependencies />", () => {
)
);

expect(container).toHaveTextContent("Packages Installed");
expect(container).toHaveTextContent("Installed Packages");
});

it("should render component in edit mode", async () => {
Expand Down

0 comments on commit ce6bdea

Please sign in to comment.