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

Fixes: Library - Connection state's position when there are no libraries around #11442 #12948

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
120 changes: 106 additions & 14 deletions kolibri/plugins/learn/assets/src/views/LibraryPage/OtherLibraries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<KGrid
gutter="0"
class="grid"
style="margin-bottom: -25px"
>
<KGridItem
:layout12="{ span: 6 }"
Expand All @@ -13,12 +14,7 @@
<h1 :style="{ marginLeft: '-8px' }">
{{ injectedtr('otherLibraries') }}
</h1>
</KGridItem>
<KGridItem
Copy link
Member

Choose a reason for hiding this comment

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

Removing the usage of KGridItem here or the margin-left: -190px; on line 322 might have had unwanted effects on the icon and string shown when searching for other libraries:

searchingLibraries

I also noticed that when the window is large, the No other libraries around you right now and Showing all available libraries around you descriptions are no longer positioned underneath the Other Libraries section header:

noOtherLibraries
availableLibraries

I think any changes you make to the connection state when there are no libraries should also be compared with the other two connection state descriptions to make sure there are no regressions.

:layout12="{ span: 6 }"
:layout8="{ span: 4 }"
:layout4="{ span: 4 }"
>

<div class="sync-status">
<span
v-show="searchingOtherLibraries"
Expand Down Expand Up @@ -55,16 +51,25 @@
/>
</span>
</span>
<span
<div
v-show="!searchingOtherLibraries && !devicesWithChannelsExist"
data-test="no-other"
class="a"
Copy link
Member

Choose a reason for hiding this comment

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

CSS class names are most effective when they are descriptive and meaningful, and indicate the purpose of the element. It would be best to avoid using vague or generic names.

Maybe instead of class names a and b, something like no-other-div and no-other-label-div? This will also make the CSS easier to read and helps other devs quickly identify which element it is referring to.

>
<span>
<KIcon icon="disconnected" />
<span data-test="no-other">
<div>
<span>
<KIcon
class="disco"
icon="disconnected"
/>
</span>
</div>
&nbsp;&nbsp;
<div class="b">
<span data-test="no-other-label">{{ injectedtr('noOtherLibraries') }}</span>
</div>
</span>
&nbsp;&nbsp;
<span data-test="no-other-label">{{ injectedtr('noOtherLibraries') }}</span>
</span>
</div>
</div>
</KGridItem>
</KGrid>
Expand Down Expand Up @@ -236,10 +241,34 @@
.sync-status {
display: flex;
justify-content: flex-end;
margin: 30px 0 10px;
min-width: 400px;
padding-left: 10px;
margin-top: -20px;
margin-bottom: 25px;
margin-left: 0;

.a {
display: flex;
align-items: center;
margin-top: -5px;
margin-left: 100px;
}

.b {
min-width: 200px;
padding-left: 00;
margin-left: 500px;
}

.disco {
margin-left: 1000px;
}

span {
display: inline-flex;
margin-top: 10px;
margin-bottom: 10px;
margin-left: -8px;
vertical-align: bottom;
}
}
Expand All @@ -257,4 +286,67 @@
margin-left: 0.75em;
}

@media screen and (max-width: 600px) {
Copy link
Member

Choose a reason for hiding this comment

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

useKResponsiveWindow is used for styling based on reactive window size information rather than CSS Media queries. For more detailed breakpoint styling, using KGridItem along with useKResponsiveWindow could be useful. There’s some examples of this being done in the Kolibri codebase here, here, and here.

I saw that you mentioned logo overlapping with text on some screen sizes; perhaps this issue could be fixed by using conditional styling?

.sync-status {
max-width: 400px;

.a {
margin-right: 13px;
}

.disco {
margin-right: -640px;
}

span {
margin-left: -191px;
word-wrap: break-word;
}
}

.wifi-svg {
margin-left: -213px;
}
}
@media screen and (min-width: 600px) and (max-width: 1100px) {
.sync-status {
.a {
margin-right: 13px;
}

.disco {
margin-right: -640px;
Copy link
Member

Choose a reason for hiding this comment

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

I noticed more than 10 instances of negative margins being used. While they can be useful at times, they can be difficult to debug and make the CSS harder to read, so we try to avoid them or add a comment explaining its usage. Is there an alternative you can use in place of some of these?

}

span {
margin-left: -190px;
}
}

.wifi-svg {
margin-left: -160px;
}
}

@media screen and (min-width: 1100px) {
.sync-status {
span {
padding-left: -50px;
margin-left: -220px;
}

.a {
margin-right: 50px;
}

.disco {
margin-right: -610px;
}
}

.wifi-svg {
margin-left: -140px;
}
}

</style>
Loading