Page MenuHomePhabricator

DefaultView: Create ZMonolingualString custom component
Closed, ResolvedPublic

Assigned To
Authored By
gengh
Dec 1 2022, 8:17 PM
Referenced Files
F36456005: Screenshot from 2023-01-24 00-05-07.png
Jan 23 2023, 11:15 PM
F36456003: Screenshot from 2023-01-24 00-05-21.png
Jan 23 2023, 11:15 PM
F36357709: image.png
Jan 20 2023, 7:35 PM
F36357707: image.png
Jan 20 2023, 7:35 PM
F36357701: image.png
Jan 20 2023, 7:35 PM
F36357704: image.png
Jan 20 2023, 7:35 PM
F36357695: image.png
Jan 20 2023, 7:35 PM
F36292810: image.png
Jan 18 2023, 9:52 AM

Description

Description

NOTE: The work on this component has been started as part of the DefaultView POC (T321784)

Complete this component as per the designs specified in the Figma file.

Desired behavior/Acceptance criteria

  • In view mode: should be the language chip with language ISO code followed by the represented string
  • In edit mode: should be an editable input field with language ISO code chip (as per the designs below)
  • Editing the input value should effectively change the Z11K2 field of the monolingual string object (already accomplished as part of default view POC task T321784)
  • Must handle ZERO state (when a new ZMonolingual string is set, and no values exist for language and text)
  • Must handle different value modes (e.g. language chip when Z11K1 is not a language reference but a language literal)
  • Styles according to the attached designs

Devices and Design (URLs or screenshots)

Figma: https://www.figma.com/file/uNBSv1e4ceA8tGNr29R9vp/Default-component?node-id=3043%3A62307&t=HYKgOdmMUb1GV57x-0


Completion checklist

Event Timeline

Change 870528 had a related patch set uploaded (by Dani DW; author: Dani DW):

[mediawiki/extensions/WikiLambda@master] Styling and tests for ZMonolingualString default component.

https://gerrit.wikimedia.org/r/870528

Change 870528 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Styling and tests for ZMonolingualString default component.

https://gerrit.wikimedia.org/r/870528

Change 879555 had a related patch set uploaded (by AdesojiThisDot; author: AdesojiThisDot):

[mediawiki/extensions/WikiLambda@master] replace language label with ISOcode

https://gerrit.wikimedia.org/r/879555

gengh reassigned this task from Ddwaal to Unknown Object (User).Jan 16 2023, 9:34 AM
gengh reassigned this task from Unknown Object (User) to AdesojiThisDot.
gengh added a subscriber: Ddwaal.
gengh added a subscriber: Unknown Object (User).

@AdesojiThisDot

Please take a look at the following acceptance criteria:

  • Must handle ZERO state (when a new ZMonolingual string is set, and no values exist for language and text)
  • Must handle different value modes (e.g. language chip when Z11K1 is not a language reference but a language literal)

Regarding Zero state:

I don't think we should show an empty bubble when the ZMonolingual is on zero state, we should either remove the bubble or add something that indicates the user that the language is not selected.

Screenshot from 2023-01-16 10-35-25.png (77×401 px, 1 KB)

@AAlhazwani-WMF: what do you think about this?


Regarding literal language:

As discussed, when creating a literal Language, the language chip is empty. It should show the literal language code:

Screenshot from 2023-01-16 10-34-49.png (376×478 px, 16 KB)

Screenshot from 2023-01-16 10-34-55.png (72×299 px, 2 KB)

Regarding Zero state:

I don't think we should show an empty bubble when the ZMonolingual is on zero state, we should either remove the bubble or add something that indicates the user that the language is not selected.

Screenshot from 2023-01-16 10-35-25.png (77×401 px, 1 KB)

@AAlhazwani-WMF: what do you think about this?

Here's a proposal https://www.figma.com/file/uNBSv1e4ceA8tGNr29R9vp/Default-View?node-id=3718%3A63078&t=ZbkOKK7UDZti2Dst-1, screenshots attached below too

Scenario where language is not specified but the text is. We will display an empty chip/pill. Width is 36px, border is dashed 3, 3.

image.png (1×2 px, 222 KB)

Scenario where language is specified but the text isn't

image.png (1×1 px, 137 KB)

Scenario where both language and text are not specified

image.png (1×712 px, 57 KB)

Regarding literal language:

As discussed, when creating a literal Language, the language chip is empty. It should show the literal language code:

Screenshot from 2023-01-16 10-34-49.png (376×478 px, 16 KB)

Screenshot from 2023-01-16 10-34-55.png (72×299 px, 2 KB)

For the language code we should display the language 2 letter ISO code whenever possible, in uppercase., eg. Spanish is ES.

Change 879555 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] replace language label with ISOcode

https://gerrit.wikimedia.org/r/879555

@Adesoji I see that the patch has been merged but I noticed a couple of issues.

The input field is not using the codex classes. Is it because we're displaying the chip inside the input, or is there another reason? Without the codex classes for example there is no :focus state when you select the field. Also, the chip sizing is a bit off, more on that below.

image.png (170×916 px, 12 KB)

The styles of the chip differ from the design specs, is this because those changes will be overwrite once we add the chip component from codex? below the state of the art on beta

image.png (268×548 px, 20 KB)

and this the desired result

image.png (266×546 px, 22 KB)

This is how I tweaked the CSS, for the <span>

image.png (472×664 px, 95 KB)

And for the parent <p>

image.png (192×662 px, 34 KB)

Of course, feel to add those changes as you see best. I wrote this CSS just to get closer to the final result, not to suggest a specific implementation. Also, if anything wasn't clear in the Figma file, feel free to ping me. I would be more than happy to make the design specs and annotation as self-explanatory as possible.

These style changes have been done as part of https://phabricator.wikimedia.org/T327520 (adding the fit-content behavior to the ZMonolingualString component)

Current look in view:

Screenshot from 2023-01-24 00-05-21.png (277×594 px, 15 KB)

In edit mode:

Screenshot from 2023-01-24 00-05-07.png (342×847 px, 17 KB)

DVrandecic updated the task description. (Show Details)