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

show hostname of links widget only there're enough space w/o wrap the line #17

Closed
Ray-Eldath opened this issue Feb 15, 2021 · 2 comments · Fixed by #18
Closed

show hostname of links widget only there're enough space w/o wrap the line #17

Ray-Eldath opened this issue Feb 15, 2021 · 2 comments · Fixed by #18
Labels
feature:view Feature request relating to view components

Comments

@Ray-Eldath
Copy link
Contributor

Ray-Eldath commented Feb 15, 2021

Currently the links widget defaultly show all hostname. despite the situation where the description is long, and the item will wrap, causing very uncomforable looking, e.g.
image

and it's better to automatically discard the hostname part if there's no enough space. this could be archive by reimplement the structure in hexo-component-inferno → lib → view → widget → link.js → Links → <function> → value, using a grid system or whatnot.

currently I'm using hand-written and hard-coded length-of-string schema, kinda like this:

let item = [(0, _inferno.createVNode)(1, "span", "level-left", (0, _inferno.createVNode)(1, "span", "level-item", i, 0), 2)];
if (hostname.length <= 15)
  item.push((0, _inferno.createVNode)(1, "span", "level-right", (0, _inferno.createVNode)(1, "span", "level-item tag", hostname, 0), 2));
return (0, _inferno.createVNode)(1, "li", null, (0, _inferno.createVNode)(1, "a", "level is-mobile", item, ...

Considering the fact that this is a relatively very small, simple but great improvement, it'll be better if this small improvement could be merged into mainstream, and released ASAP.

@ppoffice
Copy link
Owner

Thank you for the advice. It's probably better to give the user an option to hide domain name labels, since you never know how long the domain name or path will be.

@ppoffice ppoffice added the feature:view Feature request relating to view components label Feb 15, 2021
@Ray-Eldath
Copy link
Contributor Author

Ray-Eldath commented Feb 16, 2021

currently I'm working on this feature (and another very small improvement), and they're both absolutely backward-compatible. I'll propose a PR once I finish it. 😉

Ray-Eldath added a commit to Ray-Eldath/hexo-component-inferno that referenced this issue Feb 16, 2021
Ray-Eldath added a commit to Ray-Eldath/hexo-component-inferno that referenced this issue Feb 21, 2021
feat(view): article_licensing supports multi-icons; feat(view): hostname now can be discarded if user specifies, fix ppoffice#17
ppoffice added a commit that referenced this issue Feb 21, 2021
feat(view): fix #17, and make article_licensing supports more than one icons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:view Feature request relating to view components
Projects
None yet
2 participants