diff options
| author | Alexandre Flament <alex@al-f.net> | 2022-06-05 21:39:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-05 21:39:58 +0200 |
| commit | f8f6b95d8faa83507b955a4949c4c6253538ede0 (patch) | |
| tree | 11d19da6e2f45a0c0d69d98c9dfbb8928a9be4ee /searx/static/themes/simple/src/less/style-center.less | |
| parent | 0ce9d9e893b37f8341d61564975b36b8af25e247 (diff) | |
| parent | 2c62360e6e13e427342260dd72880179b55fa3c8 (diff) | |
Merge pull request #1281 from dalf/style-center
Theme: add a preference to center the results
Diffstat (limited to 'searx/static/themes/simple/src/less/style-center.less')
| -rw-r--r-- | searx/static/themes/simple/src/less/style-center.less | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/searx/static/themes/simple/src/less/style-center.less b/searx/static/themes/simple/src/less/style-center.less new file mode 100644 index 000000000..749aab4e8 --- /dev/null +++ b/searx/static/themes/simple/src/less/style-center.less @@ -0,0 +1,102 @@ +/* +--center-page-width overrides the less variable @results-width when the results are centered +see the CSS rules for #results in style.less ( grid-template-columns and gap). + +In this file, the --center-page-width values comes from the Oscar theme (Bootstrap 3). + +All rules starts with ".center-aligment-yes #main_results" to be enabled only +on the /search URL and when the "center alignment" preference is enabled. +*/ + +@media screen and (min-width: @phone) { + .center-aligment-yes #main_results { + --center-page-width: 48rem; + } +} + +@media screen and (min-width: 62rem) { + .center-aligment-yes #main_results { + --center-page-width: 60rem; + } +} + +@media screen and (min-width: @tablet) { + .center-aligment-yes #main_results { + --center-page-width: 73rem; + } +} + +@media screen and (min-width: @phone) and (max-width: @tablet) { + .center-aligment-yes #main_results { + #results { + grid-template-columns: 60% 1fr; + margin-left: 0; + margin-right: 0; + } + + #urls { + .ltr-margin-left(3rem); + } + + #sidebar { + .ltr-margin-right(1rem); + } + + #backToTop { + .ltr-left(calc(60% + 1rem)); + } + } +} + +@media screen and (min-width: @tablet) { + .center-aligment-yes #main_results { + display: flex; + flex-direction: column; + align-items: center; + + #search { + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + } + + #search_header { + grid-template-columns: calc(50% - 4.5rem - var(--center-page-width) / 2) 3rem var(--center-page-width); + grid-template-areas: "na logo search" "na spacer categories"; + width: 100%; + padding-left: 0; + padding-right: 0; + } + + .search_filters { + .ltr-margin-left(0.5rem); + width: var(--center-page-width); + } + + #results { + &.only_template_images, + &.image-detail-open { + // * grid-template-columns and .ltr-margin-left are set in style.less + // * With .image-detail-open.only_template_images, the width is set in detail.less + // * #results is going to be centered because of the #main_results rules, + // align-self aligns the results on the left or right according to the language. + align-self: flex-start; + } + + &:not(.only_template_images):not(.image-detail-open) { + // the gap is set in style.less + .ltr-margin-left(1.5rem); + grid-template-columns: calc(var(--center-page-width) - @results-gap - @results-sidebar-width) @results-sidebar-width; + + #backToTop { + .ltr-left(calc(50% - @results-sidebar-width - @results-gap + 1rem + var(--center-page-width) / 2)); + } + } + + .result .content { + max-width: inherit; + } + } + } +} |