Skip to content

Checkbox, Radio and Select styles added #705

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
Checkbox, radio input styles complete, select styling in progress
  • Loading branch information
imtananikhwa committed Feb 23, 2024
commit 67d578c86b8aabee327a67817bcbc9307de3fe70
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { refMethods } from "comps/generators/withMethodExposing";

const CascaderStyle = styled(Cascader)<{ $style: CascaderStyleType }>`
width: 100%;
font-family:"Montserrat";
${(props) => props.$style && getStyle(props.$style)}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { BoolControl } from "../../controls/boolControl";
import { LabelControl } from "../../controls/labelControl";
import { BoolCodeControl, StringControl } from "../../controls/codeControl";
import { PaddingControl } from "../../controls/paddingControl";
import { PaddingControl } from "../../controls/paddingControl";
import { MarginControl } from "../../controls/marginControl";
import {
ControlNode,
Expand Down Expand Up @@ -65,8 +65,15 @@ export const getStyle = (
height: auto;
}
.ant-select-selection-search {
padding: ${style.padding};
padding: ${style.padding};
}
.ant-select-selection-search-input {
font-family:${(style as SelectStyleType).fontFamily} !important;
font-size:${(style as SelectStyleType).textSize} !important;
font-weight:${(style as SelectStyleType).textWeight};
color:${(style as SelectStyleType).text} !important;
font-style:${(style as SelectStyleType).fontStyle};
}
.ant-select-selector::after,
.ant-select-selection-placeholder,
.ant-select-selection-item {
Expand All @@ -88,6 +95,7 @@ export const getStyle = (
.ant-select-selector {
background-color: ${style.background};
border-color: ${style.border};
border-width:${(style as SelectStyleType).borderWidth};
}

&.ant-select-focused,
Expand All @@ -101,18 +109,18 @@ export const getStyle = (
.ant-select-clear {
background-color: ${style.background};
color: ${style.text === "#222222"
? "#8B8FA3"
: isDarkColor(style.text)
? lightenColor(style.text, 0.2)
: style.text};
? "#8B8FA3"
: isDarkColor(style.text)
? lightenColor(style.text, 0.2)
: style.text};
}

.ant-select-clear:hover {
color: ${style.text === "#222222"
? "#8B8FA3"
: isDarkColor(style.text)
? lightenColor(style.text, 0.1)
: style.text};
? "#8B8FA3"
: isDarkColor(style.text)
? lightenColor(style.text, 0.1)
: style.text};
}

&.ant-select-multiple .ant-select-selection-item {
Expand Down Expand Up @@ -160,7 +168,7 @@ const getDropdownStyle = (style: MultiSelectStyleType) => {
`;
};

const Select = styled(AntdSelect)<{ $style: SelectStyleType & MultiSelectStyleType }>`
const Select = styled(AntdSelect) <{ $style: SelectStyleType & MultiSelectStyleType }>`
width: 100%;

${(props) => props.$style && getStyle(props.$style)}
Expand Down Expand Up @@ -197,7 +205,7 @@ export const SelectChildrenMap = {
inputValue: stateComp<string>(""), // user's input value when search
showSearch: BoolControl.DEFAULT_TRUE,
viewRef: RefControl<BaseSelectRef>,
margin: MarginControl,
margin: MarginControl,
padding: PaddingControl,
...SelectInputValidationChildren,
...formDataChildren,
Expand Down Expand Up @@ -235,8 +243,8 @@ export const SelectUIView = (
onSearch={
props.showSearch
? (value) => {
props.dispatch(changeChildAction("inputValue", value, false));
}
props.dispatch(changeChildAction("inputValue", value, false));
}
: undefined
}
>
Expand All @@ -248,6 +256,7 @@ export const SelectUIView = (
label={option.label}
disabled={option.disabled}
key={option.value}
style={{fontFamily:"Montserrat"}}
>
<Wrapper className="option-label">
{props.options.findIndex((option) => hasIcon(option.prefixIcon)) > -1 &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ type SelectEditProps = {
options: any[];
};

const defaultProps: any = {}
const SelectEdit = (props: SelectEditProps) => {
const [currentValue, setCurrentValue] = useState(props.initialValue);

return (
<SelectUIView
<SelectUIView
{...defaultProps}
value={currentValue}
options={options}
onChange={(val) => {
props.onChange(val);
setCurrentValue(val)
}}
onEvent={async (eventName)=>{
if(eventName==="blur"){
onEvent={async (eventName) => {
if (eventName === "blur") {
props.onChangeEnd()
}
return []
Expand Down Expand Up @@ -66,7 +68,8 @@ export const ColumnSelectComp = (function () {
onChange={props.onChange}
onChangeEnd={props.onChangeEnd}
/>
)})
)
})
.setPropertyViewFn((children) => {
return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,20 +735,23 @@ export const SwitchStyle = [
] as const;

export const SelectStyle = [
LABEL,
...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"),
TEXT,
MARGIN,
PADDING,
// LABEL,
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'border', [...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc")]),

// ...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"),
// TEXT,
// MARGIN,
// PADDING,
...ACCENT_VALIDATE,
] as const;

const multiSelectCommon = [
LABEL,
...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"),
TEXT,
MARGIN,
PADDING,
...replaceAndMergeMultipleStyles(STYLING_FIELDS_SEQUENCE, 'border', [...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc")]),
// LABEL,
// ...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"),
// TEXT,
// MARGIN,
// PADDING,
{
name: "tags",
label: trans("style.tags"),
Expand Down