drone/web/src/components/DiffViewer/DiffViewer.module.scss
Tan Nhu 43c7e94e06 Add markdown editor into commenting (#128)
* Small refactoring

* Refactoring: Make it a bit easier for DOM manipulation

* Add markdown editor into commenting
2022-12-20 11:28:56 -08:00

235 lines
4.6 KiB
SCSS

.main {
--border-color: var(--grey-200);
border-radius: 5px;
min-height: 36px;
:global {
.d2h-wrapper > div {
margin-bottom: 0;
}
.d2h-file-wrapper {
border: 0;
.d2h-diff-tbody {
&,
tr {
position: relative;
}
}
&.side-by-side-file-diff {
.d2h-code-side-linenumber.d2h-info {
pointer-events: none;
}
}
[data-annotated='true'] [data-content-for-line-number],
[data-content-for-line-number=''],
.d2h-emptyplaceholder[data-content-for-line-number=''] {
&,
:hover {
[data-annotation-for-line] {
pointer-events: none;
display: none;
}
}
}
[data-content-for-line-number] {
cursor: default;
[data-annotation-for-line] {
position: absolute;
top: 1px;
left: 60px;
display: flex;
height: 14px;
width: 14px;
font-weight: 600;
background: var(--purple-500);
color: var(--white);
text-align: center;
border-radius: 5px;
align-items: center;
justify-content: center;
cursor: pointer;
visibility: hidden;
}
&:hover [data-annotation-for-line] {
visibility: visible;
transform: scale(1.5);
transition: transform 0.75s;
}
}
&.line-by-line-file-diff {
[data-annotation-for-line] {
left: 102px;
}
}
}
.d2h-file-header {
display: none;
}
.d2h-files-diff {
.d2h-code-side-linenumber {
border-left: 0;
}
}
.d2h-file-side-diff {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.d2h-code-side-linenumber {
width: 56px;
}
}
&.collapsed {
.diffHeader {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
.diffContent {
display: none;
}
}
&.offscreen {
.diffContent {
display: none;
}
}
.diffHeader {
display: grid;
align-items: center;
background-color: var(--grey-100);
position: sticky;
top: var(--diff-viewer-sticky-top, 0);
z-index: 1;
padding: 5px 10px 5px 5px;
border: 1px solid var(--border-color);
border-top-left-radius: 5px;
border-top-right-radius: 5px;
.fname {
font-size: 13px !important;
font-weight: 600 !important;
color: var(--grey-900) !important;
align-self: center;
}
}
.viewLabel {
display: flex;
font-size: 12px;
color: var(--grey-600);
border: 1px solid var(--grey-200);
padding: 3px 6px;
border-radius: 3px;
cursor: pointer;
input {
display: inline-block;
margin-right: var(--spacing-small);
}
}
.diffContent {
border-left: 1px solid var(--border-color);
border-right: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
max-width: calc(100vw - 320px);
}
}
.annotationCell {
padding: var(--spacing-medium);
.annotationContainer {
box-sizing: border-box;
height: 100%;
max-width: 900px;
position: sticky;
left: 0;
background: var(--white);
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
border-radius: 4px;
&[data-view-style='side-by-side'] {
width: calc(100vw / 2 - 194px);
}
:global {
.cm-editor .cm-line {
&,
* {
font-family: var(--font-family);
font-size: 13px;
}
}
.md-editor-preview {
display: none;
}
.md-editor,
.md-editor-toolbar-warp {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.md-editor-content {
padding: var(--spacing-small) var(--spacing-xsmall);
background-color: var(--white);
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
.ͼ1.cm-editor.cm-focused {
outline: none !important;
}
}
.cm-content {
min-height: 46px;
}
}
}
}
.commentContainer {
box-shadow: 0px 0px 1px rgba(40, 41, 61, 0.08), 0px 0.5px 2px rgba(96, 97, 112, 0.16);
&.hasContents {
.actionsBar {
display: none;
}
&:focus-within .actionsBar {
display: block;
}
}
.editorContainer {
border-radius: 4px;
border: 1.5px solid var(--grey-100);
&:focus-within {
border: 1.5px solid var(--primary-7);
}
}
}