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

Plugin details style fixes #5084

Merged
merged 4 commits into from
Jul 31, 2024
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
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
Loading