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

fix($theme-default): add text ellipsis to navbar (#1683) #1840

Merged
merged 1 commit into from
Sep 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/@vuepress/theme-default/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,9 @@ $navbar-horizontal-padding = 1.5rem
display none
.links
padding-left 1.5rem
.site-name
width calc(100vw - 9.4rem)
Copy link
Member

Choose a reason for hiding this comment

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

Where does the 9.4rem come from? A comment would be helpful because it seems custom otherwise

Copy link
Contributor Author

@YuYang019 YuYang019 Sep 7, 2019

Choose a reason for hiding this comment

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

it is caculated by padding and the width of search icon

image

padding-left: 4rem
padding-right: 1.5rem
sum: 4 + 1.5 = 5.5rem

image

padding-left: 1.5rem
width: 2.5rem
sum: 2.5 + 1.5 = 4rem

so .site-name width = 100vw - (5.5rem + 4rem) = 100vw - 9.5rem

but why 9.4rem ?Because I found that it could display one more Chinese character in the iPhone 6/7/8 Plus (Chinese only)

100vw -9.5rem
image

100vw - 9.4rem
image

I think the title should show as much text as possible.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@bencodezen is that ok for you?

Copy link
Member

Choose a reason for hiding this comment

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

@kefranabg Yup I'm good for now. In the future, we may want to abstract out these calculations since these are "magic numbers," but since the issue number is tagged in the commit, let's go ahead and merge.

overflow hidden
white-space nowrap
text-overflow ellipsis
</style>