-
Notifications
You must be signed in to change notification settings - Fork 16
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
Readonly boolean 2 #2853
Readonly boolean 2 #2853
Conversation
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-2853/ |
@@ -1,4 +1,4 @@ | |||
:host(limel-example-readonly-boolean) { | |||
:host(limel-example-label) { |
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.
we should also remember to reword the commit title
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.
Everything is fixups to your commits and targets your branch 😄
readonlyLabels={[ | ||
{ | ||
value: true, | ||
icon: 'news', | ||
text: 'Is subscribed to receive newsletters', |
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.
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.
readonlyLabels={[ | ||
{ | ||
value: true, | ||
icon: 'news', | ||
text: 'Is subscribed to receive newsletters', | ||
}, | ||
{ | ||
value: false, | ||
icon: { | ||
name: 'cancel_subscription', | ||
color: 'rgb(var(--color-orange-default))', | ||
}, | ||
text: 'Is unsubscribed from newsletters', |
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.
Screen.Recording.2024-03-26.at.11.55.03.mov
these seem to work in a weird way for limel-switch. You have to toggle the selected state for them to work
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.
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.
Screen.Recording.2024-03-26.at.11.57.24.mov
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.
src/components/label/label.tsx
Outdated
* @beta | ||
*/ | ||
@Component({ | ||
tag: 'limel-label', |
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.
tag: 'limel-label', | |
tag: 'limel-dynamic-label', |
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.
src/components/label/label.tsx
Outdated
* value. A label can consist of a text and an icon. If no matching label is | ||
* found, the default label will be displayed. |
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.
To me this description is unclear:
If no matching label is found, the default label will be displayed.
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.
src/components/label/label.tsx
Outdated
/** | ||
* The value of the component. | ||
* | ||
* The value will be matched with the given labels to determine what label | ||
* to display | ||
*/ | ||
@Prop({ reflect: true }) | ||
public value: LabelValue; | ||
|
||
/** | ||
* Default label to display if no label with corresponding value is found | ||
*/ | ||
@Prop({ reflect: true }) | ||
public defaultLabel: Omit<Label, 'value'> = {}; | ||
|
||
/** | ||
* Available labels | ||
*/ | ||
@Prop() | ||
public labels: Label[] = []; |
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.
I can't say that I read these docs and understand what these props do 😅
Even when I look at the code, I am still confused. But the consumer only sees the props' description in the generated docs. So the docs should make it clear what these props do.
I tried to improve the docs like below:
/** | |
* The value of the component. | |
* | |
* The value will be matched with the given labels to determine what label | |
* to display | |
*/ | |
@Prop({ reflect: true }) | |
public value: LabelValue; | |
/** | |
* Default label to display if no label with corresponding value is found | |
*/ | |
@Prop({ reflect: true }) | |
public defaultLabel: Omit<Label, 'value'> = {}; | |
/** | |
* Available labels | |
*/ | |
@Prop() | |
public labels: Label[] = []; | |
/** | |
* The current value of the component; | |
* which is used to match with the `labels` array to determine the label to display. | |
* If no matching label is found, the `defaultLabel` is displayed. | |
*/ | |
@Prop({ reflect: true }) | |
public value: LabelValue; | |
/** | |
* The label to display when no matching value is found in the `labels` array. | |
* This is a fallback label that ensures there's always a label displayed for the component. | |
*/ | |
@Prop({ reflect: true }) | |
public defaultLabel: Omit<Label, 'value'> = {}; | |
/** | |
* An array of available labels. Each label in this array has a corresponding value. | |
* When the `value` prop matches a value in this array, the corresponding label is displayed. | |
*/ | |
@Prop() | |
public labels: Label[] = []; |
However, I am still unsatisfied and confused 😕 .
What if we rename the component to limel-dynamic-label
and then we can rename the props like these:
/** | |
* The value of the component. | |
* | |
* The value will be matched with the given labels to determine what label | |
* to display | |
*/ | |
@Prop({ reflect: true }) | |
public value: LabelValue; | |
/** | |
* Default label to display if no label with corresponding value is found | |
*/ | |
@Prop({ reflect: true }) | |
public defaultLabel: Omit<Label, 'value'> = {}; | |
/** | |
* Available labels | |
*/ | |
@Prop() | |
public labels: Label[] = []; | |
/** | |
* The current value of the component; | |
* which is used to match with the `dynamicLabels` array to determine the label to display. | |
* If no matching label is found, the `label` is displayed. | |
*/ | |
@Prop({ reflect: true }) | |
public value: LabelValue; | |
/** | |
* The label to display when no matching value is found in the `dynamicLabels` array. | |
* This is a fallback label that ensures there's always a label displayed for the component. | |
*/ | |
@Prop({ reflect: true }) | |
public label: Omit<Label, 'value'> = {}; | |
/** | |
* An array of available labels which can be dynamically applied based on the given value. | |
* Each label in this array will have to have a corresponding value. | |
* When the `value` prop matches a value in this array, | |
* the corresponding label is dynamically displayed. | |
*/ | |
@Prop() | |
public dynamicLabels: Label[] = []; |
A bit better. But what do you think?
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.
I updated the descriptions but did not change the names
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.
I'm OK if you wanna squash all these and merge them into my branch. I think we can continue from there more easily.
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.
We can't squash them here easily, lets just merge it to the other branch first
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.
sure. I just mean things are OK from my perspective
Suggestions for improvements for #2747
limel-label
to make it reusable in other scenariosbooleans
ReadonlyProps
, theLabel
interface now represents a single label with avalue
,text
andicon