Skip to content

Conversation

erzik987
Copy link
Contributor

Frontend Pull Request Description

NUI-6260

Move color picker from dashboard to bits and add new variant of color picker

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have updated change log
  • I have been following Definition of done
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new lint warnings
  • New and existing unit tests pass locally and on CI with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (if applicable)

image image

Additional Context (if necessary)

import trimStart from "lodash/trimStart";

export function getColorValueByName(colorVariable: string): string {
if (!startsWith(colorVariable, "var(")) {
Copy link
Contributor

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("), ")"));
Copy link
Contributor

@pilat-martin pilat-martin Sep 26, 2025

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">
Copy link
Contributor

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,
Copy link
Contributor

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[];
Copy link
Contributor

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 {
Copy link
Contributor

@pilat-martin pilat-martin Sep 26, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants