-
Notifications
You must be signed in to change notification settings - Fork 4
[WIP] replace editable title with borderless textfield #127
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
📚 Storybook preview (updated to 34d9d8f) |
sallkall
left a comment
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.
https://www.figma.com/file/3UGpxxcciW9bhWqC4ZjL7N/Query-Lab?node-id=2667%3A204232 |
|
@sallkall do you want the title to have the delete icon at the end ?? |
|
@kc-leung could you please sort out & finish this branch as well? |
I will ask veronika to take a look |
vlatawiec
left a comment
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.
thanks for the review! the width is automatically calculated based on the length of title since some words/special characters are smaller, it causes that issue. Any suggestion on how we can get the width of input box grow automatically? @geoerika @hyx131 @amy83762100 |
| alignItems: 'center', | ||
| margin: '0 0.6rem', | ||
| display: 'flex', | ||
|
|
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.
no need for empty line here, please.
Of the top of my head, I can only think of measuring the rendered text each time it changes, but it might be overkill. I used this method to calculate stuff in chart-system: https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393 |
|
@kc-leung don't forget to implement the delete function of the delete icon in the text field... or it's just not working? Should we remove it, because right now it doesn't do anything. |
doesn't it work for you? Let rebase the branch and get the latest version of Lumen-Labs |
@kc-leung using the method I suggested above is solving some of the issues with getting too much space. Then, when you set the width to the TextField do: There seems to be inconsistencies between what input font & size that comes from the tailwindcss. The styling is text-sm, which would translate in 14px font size and a normal font weight, but what we see in reality is thicker and larger. That's why I used Please check on this and use the exact values the input field has. |
yarn lint --fix
| if (textfieldRef.current) { | ||
| let el = textfieldRef.current.childNodes[0][0] | ||
| const lengthSize = el.value.length > 12 ? 14 : 16 | ||
| el.style.width = `${getTextSize(el.value, 700, lengthSize, 'Open Sans').width}px` |
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.
@kc-leung could you determine the font family from the 'el' component and use it instead of Open Sans? I believe widget-studio uses this font in its storybook, otherwise it will probably just use whatever font is in use for the application where it is plugged in. From what I see, the design team uses PT Sans for widget-studio design, which is also in use at the moment in the snoke-dashboard. Open Sans seems to be the fallback font.
body {
font-family: "PT Sans", "Open Sans", sans-serif;
...
}
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.
should we make the font family for the title Open Sans or PT Sans? sally's figma link is using Open Sans
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.
should we make the font family for the title Open Sans or PT Sans? sally's figma link is using Open Sans
@kc-leung Sorry, just saw this. I don't think you should set it to any font family. I believe the Widget Studio will just use whatever font family is in use in the application is plugged in. The only place we setup the font family is for the storybook.
The current Figma design for the Widget Studio uses PT Sans. The dashboard also uses PT Sans as the primary font at the moment.
@hyx131 @YizhiCatherineZhang 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.
@kc look how to determine the whole font of the element at the link I previously sent. Try use all the functions there, getCssStyle, getCanvasFont & modify getTextSize to receive only 2 params, text & font.
https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393

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.
Somehow, there are still some inconsistencies with the length calculated here, in WS, which I don't understand where they come from. This function works perfectly for my in chart-system.
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.
@geoerika getting dynamically the font-size is not enough since some letters are smaller it is very inconsistent. I rather have it a bit larger than cutting off the title
editable-title - fix outline on focus for input field




No description provided.