Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Feature - Select: allow sub label #24

Merged
merged 4 commits into from
Jul 13, 2020
Merged

Conversation

nicosampler
Copy link
Contributor

closes #20

@nicosampler nicosampler self-assigned this Jun 24, 2020
export const select = () => {
const items: Array<SelectItem> = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved here, so it's shown in storybook example.

@ghost
Copy link

ghost commented Jun 24, 2020

Travis automatic deployment:
https://pr24--safereactcomponents.review.gnosisdev.com

@ghost
Copy link

ghost commented Jun 29, 2020

Travis automatic deployment:
https://pr24--safereactcomponents.review.gnosisdev.com

@nicosampler nicosampler requested a review from mmv08 June 30, 2020 12:43
@ghost
Copy link

ghost commented Jun 30, 2020

Travis automatic deployment:
https://pr24--safereactcomponents.review.gnosisdev.com

@@ -64,7 +80,16 @@ function Select({ items, activeItemId, onItemClick, id, ...rest }: Props) {
return (
<MenuItem value={i.id} key={i.id}>
{i.iconUrl && <IconImg alt={i.label} src={i.iconUrl} />}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if it fails to fetch an icon?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a case for many tokens in safe multisig, we need to be able to specify a default placeholder

Copy link
Member

@mmv08 mmv08 Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, makes sense, but what image should we use, this is a generic component, so I would guess that using a token image as a placeholder won't be useful in many cases.

Perhaps we can add a new prop, defaultPlacehoder, and make it be a react component.

wdty?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't need to be a react component but an image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but if they pass an URL, we can have the same problem. Or am I missing something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if they pass a react component which uses an invalid image url we can have the same problem

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no fully bulletproof solution

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's accept another URL to load in case the main URL fails.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

url or image source

Comment on lines 85 to 91
<Text size="sm" color="secondary" strong>
{i.title}
</Text>
)}
<Text size="sm" color="text">
{i.label}
</Text>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2020-07-02 at 17 39 05

The color seems to be the same even different props are passed, is that expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean the text color? Yes, it's hardcoded, do you think Title/Label colors should be customized via props?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title:
<Text size="sm" color="secondary" strong>

Label:
<Text size="sm" color="text">

one has color secondary and another one has color text, but the rendered colors are the same, is this expected? In general I'd expect secondary color to be more faded compared to the main color

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think it makes more sense to make label a primary text (so label = title), and add a prop for secondary text (would replace label)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that will be a "breaking visual" change. perhaps we can rename it to mainLabel instead of title.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt @mikheevm ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

label should be the main text

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently it doesn't make sense

imagine I want to display this

{
   "name": "ETH",
   "balance": "0.3 ETH"
}

so in this case, title = name, label = balance

but balance should not be used as a label, label should equal to name prop. And the balance is just a secondary text

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should get rid of title and instead use label/secondary text

@nicosampler
Copy link
Contributor Author

@mikheevm changes were done!

@ghost
Copy link

ghost commented Jul 7, 2020

Travis automatic deployment:
https://pr24--safereactcomponents.review.gnosisdev.com

@nicosampler nicosampler requested a review from mmv08 July 13, 2020 14:01
@mmv08 mmv08 merged commit b83b411 into development Jul 13, 2020
@mmv08 mmv08 deleted the issue-20-select-sublable branch July 13, 2020 14:12
@nicosampler nicosampler mentioned this pull request Jul 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modify select to support sub-label
3 participants