mirror of
https://github.com/discourse/discourse.git
synced 2025-02-10 13:24:55 +00:00
84a87a703c
Allows users to configure their own custom sidebar sections with links withing Discourse instance. Links can be passed as relative path, for example "/tags" or full URL. Only path is saved in DB, so when Discourse domain is changed, links will be still valid. Feature is hidden behind SiteSetting.enable_custom_sidebar_sections. This hidden setting determines the group which members have access to this new feature.
189 lines
4.3 KiB
SCSS
189 lines
4.3 KiB
SCSS
:root {
|
|
--d-sidebar-width: #{$d-sidebar-width};
|
|
--d-sidebar-animation-time: 0.25s;
|
|
--d-sidebar-animation-ease: ease-in-out;
|
|
--d-sidebar-row-height: 30px;
|
|
// 1.25rem gets text left-aligned with the hamburger icon
|
|
--d-sidebar-row-horizontal-padding: 1.25rem;
|
|
--d-sidebar-row-vertical-padding: 0.33rem;
|
|
--d-sidebar-row-font-size: var(--font-down-1);
|
|
}
|
|
|
|
.sidebar-row {
|
|
box-sizing: border-box;
|
|
height: var(--d-sidebar-row-height);
|
|
padding: var(--d-sidebar-row-vertical-padding)
|
|
var(--d-sidebar-row-horizontal-padding);
|
|
align-items: center;
|
|
font-size: var(--d-sidebar-row-font-size);
|
|
}
|
|
|
|
.sidebar-wrapper {
|
|
display: flex;
|
|
--d-sidebar-highlight-color: var(--primary-low);
|
|
background-color: var(--primary-very-low);
|
|
grid-area: sidebar;
|
|
position: sticky;
|
|
top: var(--header-offset);
|
|
|
|
.footer-nav-ipad & {
|
|
top: calc(var(--header-offset) + var(--footer-nav-height));
|
|
}
|
|
height: calc(100vh - var(--header-offset, 0));
|
|
align-self: start;
|
|
overflow-y: auto;
|
|
|
|
.sidebar-container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
box-sizing: border-box;
|
|
height: 100%;
|
|
width: 100%;
|
|
padding: 0;
|
|
overflow-x: hidden;
|
|
// allows sidebar to scroll to the bottom when the composer is open
|
|
height: calc(100% - var(--composer-height, 0));
|
|
}
|
|
|
|
.sidebar-sections {
|
|
display: flex;
|
|
flex-direction: column;
|
|
box-sizing: border-box;
|
|
flex: 1;
|
|
padding: 1.5em 0 1em;
|
|
overflow-x: hidden;
|
|
overflow-y: overlay;
|
|
|
|
// custom scrollbar styling
|
|
--scrollbarBg: transparent;
|
|
--scrollbarThumbBg: var(--primary-low);
|
|
--scrollbarWidth: 0.5em;
|
|
|
|
scrollbar-color: transparent var(--scrollbarBg);
|
|
transition: scrollbar-color 0.25s ease-in-out;
|
|
transition-delay: 0.5s;
|
|
|
|
&::-webkit-scrollbar {
|
|
width: var(--scrollbarWidth);
|
|
}
|
|
|
|
&::-webkit-scrollbar-thumb {
|
|
background-color: transparent;
|
|
border-radius: calc(var(--scrollbarWidth) / 2);
|
|
}
|
|
|
|
&::-webkit-scrollbar-track {
|
|
background-color: transparent;
|
|
}
|
|
|
|
&:hover {
|
|
scrollbar-color: var(--scrollbarThumbBg) var(--scrollbarBg);
|
|
|
|
&::-webkit-scrollbar-thumb {
|
|
background-color: var(--scrollbarThumbBg);
|
|
}
|
|
|
|
transition-delay: 0s;
|
|
}
|
|
}
|
|
}
|
|
|
|
.sidebar-hamburger-dropdown {
|
|
.discourse-no-touch & {
|
|
.sidebar-section-wrapper .sidebar-section-header-wrapper:hover,
|
|
.sidebar-section-wrapper .sidebar-section-header-wrapper:focus-within {
|
|
background: transparent;
|
|
}
|
|
}
|
|
|
|
.sidebar-footer-wrapper {
|
|
margin-top: 1em;
|
|
.sidebar-footer-container {
|
|
background: var(--secondary);
|
|
&:before {
|
|
background: linear-gradient(
|
|
to bottom,
|
|
transparent,
|
|
rgba(var(--secondary-rgb), 1)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.sidebar-custom-sections {
|
|
.btn-flat.add-section {
|
|
margin-left: calc(var(--d-sidebar-section-link-prefix-width) / 2);
|
|
margin-right: calc(var(--d-sidebar-section-link-prefix-width) / 2);
|
|
width: calc(100% - var(--d-sidebar-section-link-prefix-width));
|
|
svg {
|
|
height: 0.75em;
|
|
width: 0.75em;
|
|
padding-left: 0.5em;
|
|
padding-right: 0.5em;
|
|
}
|
|
&:before,
|
|
&:after {
|
|
content: "";
|
|
flex: 1 1;
|
|
border-bottom: 1px solid var(--primary-low-mid);
|
|
margin: auto;
|
|
}
|
|
&:hover {
|
|
background: var(--d-sidebar-highlight-color);
|
|
border-radius: 5px;
|
|
&:before,
|
|
&:after {
|
|
border-bottom: 1px solid var(--primary-high);
|
|
}
|
|
}
|
|
}
|
|
a.sidebar-section-link {
|
|
padding-left: calc(
|
|
var(--d-sidebar-section-link-prefix-width) +
|
|
var(--d-sidebar-section-link-prefix-margin-right) +
|
|
var(--d-sidebar-row-horizontal-padding)
|
|
);
|
|
}
|
|
}
|
|
.sidebar-section-form-modal {
|
|
.modal-inner-container {
|
|
width: var(--modal-max-width);
|
|
}
|
|
input {
|
|
width: 100%;
|
|
}
|
|
input.warning {
|
|
border: 1px solid var(--danger);
|
|
}
|
|
.row-wrapper {
|
|
display: grid;
|
|
grid-template-columns: auto auto 2em;
|
|
gap: 1em;
|
|
margin-top: 1em;
|
|
}
|
|
.delete-link {
|
|
height: 1em;
|
|
align-self: end;
|
|
margin-bottom: 0.75em;
|
|
margin-right: 1em;
|
|
}
|
|
.btn-flat.add-link {
|
|
float: right;
|
|
margin-top: 1em;
|
|
margin-right: -0.5em;
|
|
&:active,
|
|
&:focus {
|
|
background: none;
|
|
}
|
|
}
|
|
.modal-footer {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.delete {
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
}
|