Skip to content

Feature/styletypes improvement #637

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

Merged
merged 5 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Style Icons
  • Loading branch information
FalkWolsky committed Jan 14, 2024
commit 067ded9dfee63c21cf276f5644aabbadeecbcea0
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ const ColorBlock = styled.div<{ $color: string }>`
cursor: pointer;
background-clip: content-box;
overflow: hidden;
`;
`;
4 changes: 2 additions & 2 deletions client/packages/lowcoder/src/components/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default function ColorPicker(props: ColorConfigProps) {
)}
{colorKey === "margin" && (
<div className="config-input">
<Margin $margin={defaultMargin || "3px"}>
<Margin $margin={defaultMargin || "4px"}>
<div>
<ExpandIcon title="" />
</div>
Expand All @@ -215,7 +215,7 @@ export default function ColorPicker(props: ColorConfigProps) {
)}
{colorKey === "padding" && (
<div className="config-input">
<Padding $padding={defaultPadding || "3px"}>
<Padding $padding={defaultPadding || "4px"}>
<div>
<CompressIcon title="" />
</div>
Expand Down
37 changes: 19 additions & 18 deletions client/packages/lowcoder/src/comps/controls/styleControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
ExpandIcon,
CompressIcon,
TextSizeIcon,
PencilIcon,
ShowBorderIcon,
} from "lowcoder-design";
import { useContext } from "react";
import styled from "styled-components";
Expand Down Expand Up @@ -250,19 +252,11 @@ const StyleContent = styled.div`
}
`;

const RadiusIcon = styled(IconRadius)`
margin: 0 8px 0 -2px;
`;

const MarginIcon = styled(ExpandIcon)`
margin: 0 8px 0 -2px;
`;
const PaddingIcon = styled(CompressIcon)`
margin: 0 8px 0 -2px;
`;
const StyledTextSizeIcon = styled(TextSizeIcon)`
margin: 0 8px 0 -2px;
`;
const RadiusIcon = styled(IconRadius)` margin: 0 8px 0 -2px;`;
const BorderIcon = styled(ShowBorderIcon)` margin: 0px 10px 0 3px;`;
const MarginIcon = styled(ExpandIcon)` margin: 0 8px 0 2px;`;
const PaddingIcon = styled(CompressIcon)` margin: 0 8px 0 2px;`;
const StyledTextSizeIcon = styled(TextSizeIcon)` margin: 0 8px 0 0px;`;
const ResetIcon = styled(IconReset)`
&:hover g g {
stroke: #315efb;
Expand Down Expand Up @@ -366,22 +360,29 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
{ filterText: config.label },
<div key={index}>
{(name === "radius" ||
name === "borderWidth" ||
name === "gap" ||
name === "cardRadius")
? (
children[name] as InstanceType<typeof StringControl>
).propertyView({
label: config.label,
preInputNode: <RadiusIcon title="" />,
preInputNode: <RadiusIcon title="Radius" />,
placeholder: props[name],
})
})
: name === "borderWidth"
? (
children[name] as InstanceType<typeof StringControl>
).propertyView({
label: config.label,
preInputNode: <BorderIcon title="Border-Width" />,
placeholder: props[name],
})
: name === "margin"
? (
children[name] as InstanceType<typeof StringControl>
).propertyView({
label: config.label,
preInputNode: <MarginIcon title="" />,
preInputNode: <MarginIcon title="Margin" />,
placeholder: props[name],
})
: (name === "padding" ||
Expand All @@ -392,7 +393,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
children[name] as InstanceType<typeof StringControl>
).propertyView({
label: config.label,
preInputNode: <PaddingIcon title="" />,
preInputNode: <PaddingIcon title="Padding" />,
placeholder: props[name],
})
: name === "textSize"
Expand Down