-
Notifications
You must be signed in to change notification settings - Fork 25
Add color picker to bits #782
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
base: main
Are you sure you want to change the base?
Conversation
.../src/components/demo/color-picker/color-picker-basic/color-picker-basic.example.component.ts
Show resolved
Hide resolved
.../components/demo/color-picker/color-picker-palette/color-picker-palette.example.component.ts
Show resolved
Hide resolved
...rc/components/demo/color-picker/color-picker-select/color-picker-select.example.component.ts
Show resolved
Hide resolved
import trimStart from "lodash/trimStart"; | ||
|
||
export function getColorValueByName(colorVariable: string): string { | ||
if (!startsWith(colorVariable, "var(")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not colorVariable.startsWith
?
if (!startsWith(colorVariable, "var(")) { | ||
return colorVariable; | ||
} | ||
const colorName = trim(trimEnd(trimStart(colorVariable, "var("), ")")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we shouldn't rely on lodash so much. useing regex might be better here, maybe something like /var\((.*)\)/
class="color-picker-select-label" | ||
[displayValueTemplate]="colorPickerTemplate" | ||
> | ||
<div *ngFor="let item of palette"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's not mix old and new control flow syntax
templateUrl: "./color-picker.component.html", | ||
styleUrls: ["./color-picker.component.less"], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big issue but I'm for new components being standalone. What do you think @pavlo-poimanov
/** | ||
* Colors to be displayed as array of strings | ||
*/ | ||
@Input() colors: string[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this could be a required input.
(We could also start using signals, but I'd say that you can leave it like this for now)
public registerOnTouched(fn: () => void): void { | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
public registerOnTouched(fn: () => {}): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you change void to {}
? If you wanted "object" you can use object
type instead.
Frontend Pull Request Description
NUI-6260
Move color picker from dashboard to bits and add new variant of color picker
Checklist
Screenshots (if applicable)
Additional Context (if necessary)