debian-mirror-gitlab/app/assets/stylesheets/framework/files.scss

581 lines
11 KiB
SCSS
Raw Normal View History

2014-09-02 18:07:02 +05:30
/**
* File content holder
*
*/
2021-03-11 19:13:27 +05:30
.container-fluid.container-limited.limit-container-width {
.file-holder.readme-holder.limited-width-container .file-content {
max-width: $limited-layout-width;
margin-left: auto;
margin-right: auto;
}
}
2014-09-02 18:07:02 +05:30
.file-holder {
border: 1px solid $border-color;
2019-03-02 22:35:43 +05:30
border-top: 0;
2017-09-10 17:25:29 +05:30
border-radius: $border-radius-default;
2014-09-02 18:07:02 +05:30
2021-10-27 15:23:28 +05:30
&.file-holder-top-border {
border-top: 1px solid $border-color;
.file-title {
// Prevents the top border getting clipped by the background
border-top-left-radius: $border-radius-default;
border-top-right-radius: $border-radius-default;
}
}
&.file-holder-no-border {
border: 0;
}
2018-03-17 18:26:18 +05:30
&.file-holder-bottom-radius {
border-radius: 0 0 $border-radius-small $border-radius-small;
}
2015-11-26 14:37:03 +05:30
&.readme-holder {
2017-09-10 17:25:29 +05:30
margin: $gl-padding 0;
2015-11-26 14:37:03 +05:30
}
2014-09-02 18:07:02 +05:30
.file-title {
2015-04-26 12:48:37 +05:30
position: relative;
2017-08-17 22:00:37 +05:30
background-color: $gray-light;
2015-04-26 12:48:37 +05:30
border-bottom: 1px solid $border-color;
2014-09-02 18:07:02 +05:30
margin: 0;
text-align: left;
2015-12-23 02:04:40 +05:30
padding: 10px $gl-padding;
2016-06-02 11:05:42 +05:30
word-wrap: break-word;
2014-09-02 18:07:02 +05:30
&.file-title-clear {
padding-left: 0;
padding-right: 0;
background-color: transparent;
.file-actions {
right: 0;
}
}
2015-04-26 12:48:37 +05:30
.file-actions {
2021-01-03 14:25:43 +05:30
.btn:not(.btn-icon) {
2016-06-02 11:05:42 +05:30
padding: 0 10px;
2015-04-26 12:48:37 +05:30
font-size: 13px;
line-height: 28px;
}
2014-09-02 18:07:02 +05:30
}
2016-06-02 11:05:42 +05:30
a:not(.btn) {
2016-08-24 12:49:21 +05:30
color: $gl-text-color;
2016-04-02 18:10:28 +05:30
}
2014-09-02 18:07:02 +05:30
.left-options {
margin-top: -3px;
}
}
2016-11-03 12:29:30 +05:30
2017-09-10 17:25:29 +05:30
.file-blame-legend {
background-color: $gray-light;
text-align: right;
padding: 8px $gl-padding;
border-bottom: 1px solid $border-color;
2018-11-08 19:23:39 +05:30
@include media-breakpoint-down(xs) {
2017-09-10 17:25:29 +05:30
text-align: left;
}
.left-label {
padding-right: 5px;
}
.right-label {
padding-left: 5px;
}
.legend-box {
display: inline-block;
width: 10px;
height: 10px;
padding: 0 2px;
}
@for $i from 0 through 5 {
.legend-box-#{$i} {
2018-03-17 18:26:18 +05:30
background-color: mix($blame-cyan, $blame-blue, $i / 5 * 100%);
2017-09-10 17:25:29 +05:30
}
}
@for $i from 1 through 4 {
.legend-box-#{$i + 5} {
2018-03-17 18:26:18 +05:30
background-color: mix($blame-gray, $blame-cyan, $i / 4 * 100%);
2017-09-10 17:25:29 +05:30
}
}
}
2014-09-02 18:07:02 +05:30
.file-content {
2020-04-22 19:07:51 +05:30
background: $white;
2014-09-02 18:07:02 +05:30
2017-08-17 22:00:37 +05:30
&.image_file,
2019-12-21 20:55:43 +05:30
&.audio,
2017-08-17 22:00:37 +05:30
&.video {
2018-11-20 20:47:30 +05:30
background: $gray-darker;
2014-09-02 18:07:02 +05:30
text-align: center;
2017-09-10 17:25:29 +05:30
padding: 30px;
2016-09-29 09:46:39 +05:30
2017-08-17 22:00:37 +05:30
img,
2019-12-21 20:55:43 +05:30
audio,
2017-08-17 22:00:37 +05:30
video {
2016-09-29 09:46:39 +05:30
max-width: 80%;
2014-09-02 18:07:02 +05:30
}
}
2019-07-07 11:18:12 +05:30
&.md {
2018-03-17 18:26:18 +05:30
padding: $gl-padding;
2018-11-08 19:23:39 +05:30
@include media-breakpoint-up(md) {
2018-03-17 18:26:18 +05:30
padding: $gl-padding * 2;
}
2014-09-02 18:07:02 +05:30
}
&.blob-no-preview {
2018-11-20 20:47:30 +05:30
background: $gray-darker;
2020-04-22 19:07:51 +05:30
text-shadow: 0 1px 2px $white;
2014-09-02 18:07:02 +05:30
padding: 100px 0;
}
/**
* Blame file
*/
&.blame {
table {
2018-03-17 18:26:18 +05:30
border: 0;
2014-09-02 18:07:02 +05:30
margin: 0;
}
2016-11-03 12:29:30 +05:30
2022-01-26 12:08:38 +05:30
//
// IMPORTANT PERFORMANCE OPTIMIZATION
//
// When viewinng a blame with many commits a lot of content is rendered on the page.
// content-visibility rule below ensure that we only render what is visible to the user,
// thus reducing TBT in the browser.
// Grid is used instead of table layout because content-visibility performs better with it.
2014-09-02 18:07:02 +05:30
tr {
2022-01-26 12:08:38 +05:30
content-visibility: auto;
display: grid;
grid-template-columns: 400px max-content auto;
2018-11-20 20:47:30 +05:30
border-bottom: 1px solid $gray-darker;
2017-09-10 17:25:29 +05:30
&:last-child {
2018-03-17 18:26:18 +05:30
border-bottom: 0;
2017-09-10 17:25:29 +05:30
}
2014-09-02 18:07:02 +05:30
}
2016-11-03 12:29:30 +05:30
2014-09-02 18:07:02 +05:30
td {
2018-03-17 18:26:18 +05:30
border-top: 0;
border-bottom: 0;
2017-09-10 17:25:29 +05:30
2014-09-02 18:07:02 +05:30
&:first-child {
2018-03-17 18:26:18 +05:30
border-left: 0;
2014-09-02 18:07:02 +05:30
}
2016-11-03 12:29:30 +05:30
2014-09-02 18:07:02 +05:30
&:last-child {
2018-03-17 18:26:18 +05:30
border-right: 0;
2014-09-02 18:07:02 +05:30
}
2016-11-03 12:29:30 +05:30
2018-03-17 18:26:18 +05:30
&.blame-commit {
padding: 5px 10px;
min-width: 400px;
max-width: 400px;
background: $gray-light;
border-left: 3px solid;
.commit-row-title {
display: flex;
}
2017-09-10 17:25:29 +05:30
2018-03-17 18:26:18 +05:30
.item-title {
flex: 1;
margin-right: 0.5em;
}
2017-09-10 17:25:29 +05:30
}
2018-03-17 18:26:18 +05:30
&.line-numbers {
float: none;
2020-11-24 15:15:51 +05:30
border-left: 1px solid $gray-100;
2018-03-17 18:26:18 +05:30
i {
float: none;
margin-right: 0;
}
}
&.lines {
padding: 0;
2017-09-10 17:25:29 +05:30
}
2022-01-26 12:08:38 +05:30
.code {
height: 100%;
}
2017-09-10 17:25:29 +05:30
}
@for $i from 0 through 5 {
td.blame-commit-age-#{$i} {
2018-03-17 18:26:18 +05:30
border-left-color: mix($blame-cyan, $blame-blue, $i / 5 * 100%);
2017-09-10 17:25:29 +05:30
}
}
@for $i from 1 through 4 {
td.blame-commit-age-#{$i + 5} {
2018-03-17 18:26:18 +05:30
border-left-color: mix($blame-gray, $blame-cyan, $i / 4 * 100%);
2017-09-10 17:25:29 +05:30
}
2015-09-25 12:07:36 +05:30
}
2020-03-13 15:44:24 +05:30
.doc-versions {
2020-10-24 23:57:45 +05:30
color: $gray-400;
2020-03-13 15:44:24 +05:30
&:hover {
color: $gray-900;
}
}
2014-09-02 18:07:02 +05:30
}
&.logs {
2018-11-20 20:47:30 +05:30
background: $gray-darker;
2014-09-02 18:07:02 +05:30
max-height: 700px;
overflow-y: auto;
ol {
margin-left: 40px;
padding: 10px 0;
2015-04-26 12:48:37 +05:30
border-left: 1px solid $border-color;
2014-09-02 18:07:02 +05:30
margin-bottom: 0;
2020-04-22 19:07:51 +05:30
background: $white;
2016-11-03 12:29:30 +05:30
2014-09-02 18:07:02 +05:30
li {
2017-08-17 22:00:37 +05:30
color: $logs-li-color;
2016-11-03 12:29:30 +05:30
2014-09-02 18:07:02 +05:30
p {
margin: 0;
2017-08-17 22:00:37 +05:30
color: $logs-p-color;
2014-09-02 18:07:02 +05:30
line-height: 24px;
padding-left: 10px;
}
&:hover {
2018-11-20 20:47:30 +05:30
background: $blue-50;
2014-09-02 18:07:02 +05:30
}
}
}
}
/**
* Code file
*/
&.code {
padding: 0;
2019-09-04 21:01:54 +05:30
border-radius: 0 0 $border-radius-default $border-radius-default;
2014-09-02 18:07:02 +05:30
}
2017-08-17 22:00:37 +05:30
.list-inline.previews {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: flex-start;
align-items: baseline;
.preview {
padding: $gl-padding;
}
}
2014-09-02 18:07:02 +05:30
}
}
2016-04-02 18:10:28 +05:30
span.idiff {
&.left {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
&.right {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}
}
2017-08-17 22:00:37 +05:30
.file-stats {
ul {
list-style: none;
margin: 0;
padding: 10px 0;
li {
padding: 3px 0;
line-height: 20px;
}
}
.new-file {
a {
2018-11-20 20:47:30 +05:30
color: $green-600;
2017-08-17 22:00:37 +05:30
}
}
.renamed-file {
a {
2020-11-24 15:15:51 +05:30
color: $orange-500;
2017-08-17 22:00:37 +05:30
}
}
.deleted-file {
a {
2018-11-20 20:47:30 +05:30
color: $red-500;
2017-08-17 22:00:37 +05:30
}
}
.edit-file {
a {
color: $gl-text-color;
}
}
a {
text-decoration: none;
.new-file {
2018-11-20 20:47:30 +05:30
color: $green-600;
2017-08-17 22:00:37 +05:30
}
.deleted-file {
2018-11-20 20:47:30 +05:30
color: $red-700;
2017-08-17 22:00:37 +05:30
}
}
}
.file-title-flex-parent {
2018-11-08 19:23:39 +05:30
&,
.file-holder & {
display: flex;
2019-03-02 22:35:43 +05:30
flex-wrap: wrap;
2018-11-08 19:23:39 +05:30
align-items: center;
justify-content: space-between;
background-color: $gray-light;
border-bottom: 1px solid $border-color;
2019-03-02 22:35:43 +05:30
border-top: 1px solid $border-color;
2019-09-04 21:01:54 +05:30
padding: $gl-padding-8 $gl-padding;
2018-11-08 19:23:39 +05:30
margin: 0;
border-radius: $border-radius-default $border-radius-default 0 0;
2021-01-29 00:20:46 +05:30
@include media-breakpoint-up(md) {
flex-wrap: nowrap;
2018-11-08 19:23:39 +05:30
}
2017-08-17 22:00:37 +05:30
}
2021-01-29 00:20:46 +05:30
.file-header-content {
padding-right: 30px;
2017-08-17 22:00:37 +05:30
}
a {
color: $gl-text-color;
}
2021-03-11 19:13:27 +05:30
@include media-breakpoint-down(md) {
2018-03-17 18:26:18 +05:30
.file-actions {
2021-03-11 19:13:27 +05:30
margin-top: $gl-padding-8;
.btn {
margin-bottom: $gl-padding-8;
}
2018-03-17 18:26:18 +05:30
}
}
2017-08-17 22:00:37 +05:30
}
.is-stl-loading {
.stl-controls {
display: none;
}
}
.file-fork-suggestion {
display: flex;
align-items: center;
justify-content: flex-end;
background-color: $gray-light;
border-bottom: 1px solid $border-color;
padding: 5px $gl-padding;
}
.file-fork-suggestion-note {
margin-right: 1.5em;
}
2018-03-17 18:26:18 +05:30
2018-11-08 19:23:39 +05:30
.preview-container {
overflow: auto;
.file-container {
background-color: $gray-darker;
display: flex;
height: 100%;
align-items: center;
justify-content: center;
text-align: center;
.file-content {
padding: $gl-padding;
max-width: 100%;
max-height: 100%;
img {
max-width: 90%;
max-height: 70vh;
}
.is-zoomable {
cursor: pointer;
cursor: zoom-in;
&.is-zoomed {
cursor: pointer;
cursor: zoom-out;
max-width: none;
max-height: none;
margin-right: $gl-padding;
}
}
}
.file-info {
font-size: $label-font-size;
color: $diff-image-info-color;
}
}
2019-09-04 21:01:54 +05:30
.note-container {
.user-avatar-link.new-comment {
position: absolute;
margin: 40px $gl-padding 0 116px;
}
}
.diff-discussions:not(:last-child) .discussion .discussion-body {
padding-bottom: $gl-padding;
.discussion-reply-holder {
2020-06-23 00:09:42 +05:30
border-bottom: 1px solid $gray-50;
2019-09-04 21:01:54 +05:30
border-radius: 0;
}
}
2018-11-08 19:23:39 +05:30
.md-previewer {
padding: $gl-padding;
}
}
2019-12-21 20:55:43 +05:30
.jupyter-notebook-scrolled {
overflow-y: auto;
max-height: 20rem;
}
2020-01-01 13:55:28 +05:30
2020-11-24 15:15:51 +05:30
#js-openapi-viewer {
pre.version,
code {
background-color: transparent;
border: transparent;
}
2020-01-01 13:55:28 +05:30
}
2020-03-13 15:44:24 +05:30
2020-07-28 23:09:34 +05:30
.code-navigation-line:hover {
.code-navigation {
border-bottom: 1px $gray-darkest dashed;
2020-03-13 15:44:24 +05:30
2020-07-28 23:09:34 +05:30
&:hover {
border-bottom-color: $almost-black;
}
2020-03-13 15:44:24 +05:30
}
}
2020-07-28 23:09:34 +05:30
.code-navigation-popover.popover {
max-width: calc(min(#{px-to-rem(560px)}, calc(100vw - #{$gl-padding-32})));
}
.code-navigation-popover-container {
max-height: px-to-rem(320px);
}
.code-navigation-popover .code {
padding-left: $grid-size * 3;
text-indent: -$grid-size * 2;
2020-03-13 15:44:24 +05:30
}
2020-04-22 19:07:51 +05:30
.tree-item-link {
&:not(.is-submodule) {
span {
z-index: 2;
}
&::before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
}
}
}
2021-09-30 23:02:18 +05:30
2021-10-27 15:23:28 +05:30
.version-link {
@include gl-display-inline-block;
@include gl-align-self-center;
@include gl-mt-2;
@include gl-w-5;
@include gl-h-5;
@include gl-float-left;
background-color: $gray-400;
mask-image: asset_url('icons-stacked.svg#doc-versions');
mask-repeat: no-repeat;
mask-size: cover;
mask-position: center;
&:hover {
background-color: $black;
}
}
2021-09-30 23:02:18 +05:30
//
// IMPORTANT PERFORMANCE OPTIMIZATION BELOW
//
// * :nth-of-type(1n+70) - makes sure we do not render lines 71+ right
// away. Even though the HTML is injected in the DOM, as long as we do
// not render those lines, the browser doesn't need to spend resources
// calculating and repainting what's hidden.
//
// * :not(:last-of-type) makes sure that we output the last line of the
// blob's snippet. This is important because the column with the line
// numbers has auto width and is expanding based on the content in it.
// This leads to unnecessary layout shift when the last lines of the
// snippet are longer than two (2) digits.
// EXAMPLE: Let's say, we have a blob with 100 lines. If we output 70
// lines, and then, the remaining 30 (incl the line 100), it will lead
// to the layout reflow and styles recalculation when we output line
// 100 (because the width of '100' is always bigger than '70'). By
// outputting the last line right away, we prevent that as the column
// will always be expanded to the maximum needed width.
.blob-viewer[data-loading] .file-content.code .line:nth-of-type(1n+70):not(:last-of-type),
.blob-viewer[data-loading] .file-content.code .file-line-num:nth-of-type(1n+70):not(:last-of-type) {display: none !important;}
2021-10-27 15:23:28 +05:30
.blob-viewer[data-loading] .file-content.code .line:nth-of-type(69):not(:last-of-type),
.blob-viewer[data-loading] .file-content.code .file-line-num:nth-of-type(69):not(:last-of-type) {
&::after {
@include gl-display-block;
@include gl-font-weight-bold;
content: '\2026';
}
}
.blob-viewer[data-loading] .file-content.code .line:nth-of-type(69):not(:last-of-type) {
&::after {
@include gl-text-center;
}
}