Skip to content

Commit

Permalink
Plugin details style fixes (#5084)
Browse files Browse the repository at this point in the history
* plugin details improvements

* remove unnecessary code

* small 404 fixes
  • Loading branch information
Cloud11PL committed Aug 2, 2024
1 parent cfe015a commit f89484c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 36 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-plums-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Plugin details view now displays channel list with proper padding and text with proper size.
14 changes: 2 additions & 12 deletions src/components/ControlledSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
// @ts-strict-ignore
import { FormControlLabel, Switch } from "@material-ui/core";
import { makeStyles } from "@saleor/macaw-ui";
import { Text } from "@saleor/macaw-ui-next";
import React from "react";

const useStyles = makeStyles(
() => ({
labelText: {
fontSize: 14,
},
}),
{ name: "ControlledSwitch" },
);

interface ControlledSwitchProps {
className?: string;
checked: boolean;
Expand All @@ -26,7 +17,6 @@ interface ControlledSwitchProps {
export const ControlledSwitch: React.FC<ControlledSwitchProps> = props => {
const { checked, disabled, onChange, label, name, secondLabel, uncheckedLabel, className } =
props;
const classes = useStyles(props);

return (
<FormControlLabel
Expand All @@ -47,7 +37,7 @@ export const ControlledSwitch: React.FC<ControlledSwitchProps> = props => {
uncheckedLabel
)
) : typeof label === "string" ? (
<span className={classes.labelText}>{label}</span>
<Text>{label}</Text>
) : (
label
)}
Expand Down
10 changes: 8 additions & 2 deletions src/components/NotFoundPage/NotFoundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ const NotFoundPage: React.FC<NotFoundPageProps> = props => {
<Text className={classes.header} size={6} fontWeight="bold" lineHeight={3}>
<FormattedMessage id="yH56V+" defaultMessage="Ooops!..." />
</Text>
<Text className={classes.header} size={4} fontWeight="bold" lineHeight={2}>
<Text
className={classes.header}
size={4}
fontWeight="bold"
lineHeight={2}
display="block"
>
<FormattedMessage id="bj6pTd" defaultMessage="Something's missing" />
</Text>
<Text>
<Text display="block">
<FormattedMessage id="nRiOg+" defaultMessage="Sorry, the page was not found" />
</Text>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ const PluginDetailsChannelsCardContent: React.FC<PluginDetailsChannelsCardProps>
if (isPluginGlobal(plugin.globalConfiguration)) {
return (
<DashboardCard.Content>
<FormattedMessage {...messages.noChannelsSubtitle} />
<Text>
<FormattedMessage {...messages.noChannelsSubtitle} />
</Text>
</DashboardCard.Content>
);
}
Expand All @@ -70,7 +72,7 @@ const PluginDetailsChannelsCardContent: React.FC<PluginDetailsChannelsCardProps>
onClick={() => setSelectedChannelId(channel.id)}
>
{isChannelSelected(channel.id) && <div className={classes.itemActiveIndicator}></div>}
<DashboardCard.Content>
<DashboardCard.Content padding={4}>
<Text>{channel.name}</Text>
</DashboardCard.Content>
</div>
Expand Down
20 changes: 11 additions & 9 deletions src/plugins/components/PluginInfo/PluginInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const PluginInfo: React.FC<PluginInfoProps> = ({ data, description, errors, name
description: "plugin name",
})}
</Text>
<Text display="block" fontWeight="bold" fontSize={4}>
<Text display="block" fontWeight="bold">
{name}
</Text>
</Box>
Expand All @@ -52,14 +52,12 @@ const PluginInfo: React.FC<PluginInfoProps> = ({ data, description, errors, name
<Text fontSize={3} color="default2">
<FormattedMessage {...commonMessages.description} />
</Text>
<Text display="block" fontSize={4}>
{description}
</Text>
<Text display="block">{description}</Text>
</Box>
)}
<FormSpacer />
<Hr />
<Text display="block" paddingTop={4}>
<Text lineHeight={2} fontSize={3} color="default2" display="block" paddingTop={4}>
{intl.formatMessage({
id: "bL/Wrc",
defaultMessage: "Status",
Expand All @@ -68,10 +66,14 @@ const PluginInfo: React.FC<PluginInfoProps> = ({ data, description, errors, name
</Text>
<ControlledCheckbox
name={"active" as keyof PluginDetailsPageFormData}
label={intl.formatMessage({
id: "FA+MRz",
defaultMessage: "Set plugin as active",
})}
label={
<Text>
{intl.formatMessage({
id: "FA+MRz",
defaultMessage: "Set plugin as active",
})}
</Text>
}
checked={data.active}
onChange={onChange}
/>
Expand Down
12 changes: 8 additions & 4 deletions src/plugins/components/PluginSettings/PluginSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import React from "react";
import { useIntl } from "react-intl";

import { PluginDetailsPageFormData } from "../PluginsDetailsPage";
import { useStyles } from "./styles";

interface PluginSettingsProps {
data: PluginDetailsPageFormData;
Expand All @@ -28,7 +27,6 @@ const PluginSettings: React.FC<PluginSettingsProps> = ({
onChange,
fields,
}) => {
const classes = useStyles({});
const intl = useIntl();

return (
Expand All @@ -47,7 +45,13 @@ const PluginSettings: React.FC<PluginSettingsProps> = ({
const fieldData = fields.find(configField => configField.name === field.name);

return (
<div className={classes.item} key={field.name}>
<Box
key={field.name}
display="flex"
flexDirection="row"
alignItems="center"
marginBottom={2}
>
{fieldData.type === ConfigurationTypeFieldEnum.BOOLEAN ? (
<>
<ControlledSwitch
Expand Down Expand Up @@ -93,7 +97,7 @@ const PluginSettings: React.FC<PluginSettingsProps> = ({
onChange={onChange}
/>
)}
</div>
</Box>
);
})}
</DashboardCard.Content>
Expand Down
7 changes: 0 additions & 7 deletions src/plugins/components/PluginSettings/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ export const useStyles = makeStyles(
button: {
marginRight: theme.spacing(),
},
item: {
"&:not(:last-child)": {
marginBottom: theme.spacing(3),
},
alignItems: "center",
display: "flex",
},
itemLabel: {
fontWeight: 500,
},
Expand Down

0 comments on commit f89484c

Please sign in to comment.