-
Notifications
You must be signed in to change notification settings - Fork 18
IBX: 11010 improve anchor links switcher #1805
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |||||
|
|
||||||
| const header = doc.querySelector('.ibexa-edit-header'); | ||||||
| const headerContainer = header?.querySelector('.ibexa-edit-header__container'); | ||||||
| const anchorNavigationSwitcher = doc.querySelector('.ibexa-tabs--switcher'); | ||||||
| const SECTION_ADJUST_MARGIN_TOP = 36; | ||||||
| const formContainerNode = doc.querySelector('.ibexa-edit-content'); | ||||||
| const lastSectionObserver = new ResizeObserver(() => { | ||||||
|
|
@@ -88,8 +89,15 @@ | |||||
| let firstVisibleSection = visibleSections.find((section) => { | ||||||
| const { top, height } = section.getBoundingClientRect(); | ||||||
| const headerBottomContainerHeight = header.offsetHeight - headerContainer?.offsetHeight; | ||||||
|
|
||||||
| return top + height >= headerContainer?.offsetHeight + headerBottomContainerHeight + SECTION_ADJUST_MARGIN_TOP; | ||||||
| const anchorNavigationSwitcherHeight = anchorNavigationSwitcher?.offsetHeight || 0; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| return ( | ||||||
| top + height >= | ||||||
| headerContainer?.offsetHeight + | ||||||
| headerBottomContainerHeight + | ||||||
| anchorNavigationSwitcherHeight + | ||||||
| SECTION_ADJUST_MARGIN_TOP | ||||||
| ); | ||||||
| }); | ||||||
|
|
||||||
| if (!firstVisibleSection) { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,8 @@ | |||||
|
|
||||||
| .ibexa-anchor-navigation { | ||||||
| $self: &; | ||||||
| background-color: $ibexa-color-white; | ||||||
| padding: calculateRem(24px) calculateRem(32px) 0 calculateRem(32px); | ||||||
|
|
||||||
| &__sections { | ||||||
| .card { | ||||||
|
|
@@ -49,13 +51,10 @@ | |||||
| &__header { | ||||||
| height: calculateRem(87px); | ||||||
| padding: calculateRem(20px) 0 0 calculateRem(17px); | ||||||
| border-bottom: calculateRem(1px) solid $ibexa-color-light; | ||||||
| } | ||||||
|
|
||||||
| &__body { | ||||||
| height: calc(100% - #{calculateRem(87px)}); | ||||||
| overflow: auto; | ||||||
| padding: calculateRem(25px); | ||||||
| font-size: $ibexa-text-font-size-medium; | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -73,39 +72,48 @@ | |||||
|
|
||||||
| &__sections { | ||||||
| min-width: calculateRem(240px); | ||||||
| max-width: calculateRem(240px); | ||||||
| list-style: none; | ||||||
| display: none; | ||||||
| margin: calculateRem(24px) 0 0; | ||||||
| padding: calculateRem(24px) 0 0; | ||||||
| border-top: calculateRem(1px) solid $ibexa-color-light; | ||||||
| position: absolute; | ||||||
| right: calculateRem(30px); | ||||||
| z-index: 1; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. personally I would use at least sth like z-index 10 to leave possibility to add sth between 0 and &__sections |
||||||
|
|
||||||
| &--active { | ||||||
| display: block; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| &--no-border { | ||||||
| border: 0; | ||||||
| margin-top: 0; | ||||||
| padding-top: 0; | ||||||
| } | ||||||
| &__sections-header { | ||||||
| font-size: $ibexa-text-font-size-extra-large; | ||||||
| font-weight: 600; | ||||||
| color: $ibexa-color-primary; | ||||||
| margin: calculateRem(16px) 0; | ||||||
| } | ||||||
|
|
||||||
| &__sections-item { | ||||||
| height: calculateRem(32px); | ||||||
| } | ||||||
|
|
||||||
| &__sections-item-btn { | ||||||
| display: inline-flex; | ||||||
| width: 100%; | ||||||
| padding: calculateRem(11px) calculateRem(15px); | ||||||
| padding: 0; | ||||||
| border: calculateRem(1px) solid transparent; | ||||||
| border-radius: $ibexa-border-radius; | ||||||
| text-align: left; | ||||||
| color: $ibexa-color-dark-400; | ||||||
| align-items: center; | ||||||
| font-weight: 600; | ||||||
| border-left: 1px solid $ibexa-color-light; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| &::before { | ||||||
| content: ''; | ||||||
| display: block; | ||||||
| width: calculateRem(8px); | ||||||
| height: calculateRem(8px); | ||||||
| margin: calculateRem(8px) calculateRem(16px) 0 0; | ||||||
| border-radius: 50%; | ||||||
| background-color: $ibexa-color-light; | ||||||
| width: calculateRem(2px); | ||||||
| height: calculateRem(32px); | ||||||
| margin: 0 calculateRem(16px) 0 0; | ||||||
| opacity: 0; | ||||||
| } | ||||||
|
|
||||||
| &::after { | ||||||
|
|
@@ -119,21 +127,20 @@ | |||||
| } | ||||||
|
|
||||||
| &:hover { | ||||||
| color: $ibexa-color-info; | ||||||
| font-weight: 600; | ||||||
| color: $ibexa-color-primary; | ||||||
|
|
||||||
| &::before { | ||||||
| background-color: $ibexa-color-info; | ||||||
| opacity: 1; | ||||||
| background-color: $ibexa-color-primary; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| &--active { | ||||||
| color: $ibexa-color-info; | ||||||
| background: $ibexa-color-info-100; | ||||||
| font-weight: 600; | ||||||
| color: $ibexa-color-primary; | ||||||
|
|
||||||
| &::before { | ||||||
| background-color: $ibexa-color-info; | ||||||
| opacity: 1; | ||||||
| background-color: $ibexa-color-primary; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
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.
for safety,
.ibexa-tabs--switchercan be used in other contexts as well