Skip to content
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

feat: add <Line> component to render horizontal and vertical lines #556

Closed
wants to merge 1 commit into from

Conversation

AlCalzone
Copy link
Contributor

I previously tried to achieve this by measuring a Box and rendering text instead, but as mentioned in #472 (comment), the measureElement API often does not work in more complex layouts (returns NaN).
Since ink does draw boxes correctly, I figured I'd try this by implementing a Line component, so ink can handle drawing the lines.

if ('borderStyle' in style) {
const borderWidth = typeof style.borderStyle === 'string' ? 1 : 0;
const borderWidth =
domNode.nodeName === 'ink-line'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed access to nodeName here, so I figured I'd update all the applyXYZ method to take the DOM node instead.

@vadimdemedes
Copy link
Owner

I'd prefer to ship #475 instead, which will let you render Box border on a specific side, which is essentially the same as a Line component introduced here.

@AlCalzone
Copy link
Contributor Author

Fine by me. Out of curiosity, what's blocking that PR?

@vadimdemedes
Copy link
Owner

Nothing technical, only my availability.

@vadimdemedes
Copy link
Owner

Closing this, since border sides can now be disabled individually → https://github.com/vadimdemedes/ink#bordertop.

@AlCalzone AlCalzone deleted the lines branch March 28, 2023 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants