Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Common style config added, number input component updated, link compo… #698

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
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
Prev Previous commit
Creating function that helps to replace style from common style array…
… with special array of styles, so individual styles of a component also can be handled, progress bar component updated
  • Loading branch information
imtananikhwa committed Feb 21, 2024
commit a05565641865638af180f5ce36571dcdf86e3b43
3 changes: 3 additions & 0 deletions client/packages/lowcoder/src/comps/comps/progressComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const getStyle = (style: ProgressStyleType) => {
line-height: 2;
.ant-progress-text {
color: ${style.text};
font-style:${style.fontStyle};
font-family:${style.fontFamily};
font-weight:${style.textWeight};
}
width: ${widthCalculator(style.margin)};
height: ${heightCalculator(style.margin)};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,21 @@ function getStaticBackground(color: string) {
} as const;
}


function replaceAndMergeMultipleStyles(originalArray: any[], styleToReplace: string, replacingStyles: any[]): any[] {
let temp = []
let foundIndex = originalArray.findIndex((element) => element.name === styleToReplace)

if (foundIndex !== -1) {
let elementsBeforeFoundIndex = originalArray.filter((item, index) => index < foundIndex)
let elementsAfterFoundIndex = originalArray.filter((item, index) => index > foundIndex)
temp = [...elementsBeforeFoundIndex, ...replacingStyles, ...elementsAfterFoundIndex]
} else
temp = [...originalArray]

return temp
}

export const ButtonStyle = [
...getBgBorderRadiusByBg("primary"),
...STYLING_FIELDS_SEQUENCE
Expand Down Expand Up @@ -674,14 +689,6 @@ export const SliderStyle = [
export const InputLikeStyle = [
LABEL,
getStaticBackground(SURFACE_COLOR),
// TEXT,
// TEXT_SIZE,
// TEXT_WEIGHT,
// FONT_FAMILY,
// FONT_STYLE,
// MARGIN,
// PADDING,
// BORDER_WIDTH,
...STYLING_FIELDS_SEQUENCE,
...ACCENT_VALIDATE,
] as const;
Expand Down Expand Up @@ -1047,8 +1054,7 @@ export const LinkStyle = [
depType: DEP_TYPE.SELF,
transformer: toSelf,
},
...LinkTextStyle,
...STYLING_FIELDS_SEQUENCE.filter((style) => style.name !== 'text')
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'text', [...LinkTextStyle])
] as const;

export const DividerStyle = [
Expand All @@ -1070,19 +1076,18 @@ export const DividerStyle = [
})
] as const;

// Hidden border and borderWidth properties as AntD doesnt allow these properties for progress bar
export const ProgressStyle = [
{
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'text', [{
name: "text",
label: trans("text"),
depTheme: "canvas",
depType: DEP_TYPE.CONTRAST_TEXT,
transformer: contrastText,
},
}]).filter((style)=> ['border','borderWidth'].includes(style.name) === false),
TRACK,
FILL,
SUCCESS,
MARGIN,
PADDING,
] as const;

export const NavigationStyle = [
Expand Down