Skip to content
Merged
Show file tree
Hide file tree
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
129 changes: 129 additions & 0 deletions styles/components/issues/editor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import { otherThemeVars, themeVars } from "@lutinglt/gitea-github-theme/core";

/** GitHub's comment editor, for the rules of a `.combo-markdown-editor`: a bordered box whose toolbar carries the Write/Preview tabs. */
export const markdownEditor = `
border: 1px solid ${themeVars.color.light.border};
border-radius: ${otherThemeVars.border.radius};
background: ${themeVars.color.body};
& markdown-toolbar {
background: ${themeVars.color.box.header};
border-bottom: 1px solid ${themeVars.color.light.border};
}
& .markdown-toolbar-button {
color: ${themeVars.color.text.light.num1};
width: 28px;
height: 28px;
padding: 6px;
border: 0;
background: transparent;
}
& textarea {
background: ${themeVars.color.body};
font-size: 14px;
border: 1px solid ${themeVars.color.light.border};
border-radius: ${otherThemeVars.border.radius};
box-shadow: none;
}
overflow: visible;

& markdown-toolbar {
border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0;
min-height: 38px;
padding: 0 8px 0 0;
gap: 8px;

& .markdown-toolbar-group {
flex: 0 0 auto;
}
& .switch {
border: 0;
background: transparent;
border-radius: 0;
margin: 0 auto -1px 0;
min-height: 38px;
}
/* Forgejo overlaps neighbouring switch items with negative margins and paints the first one. */
& .switch .item {
height: 38px;
min-height: 38px;
margin: 0 !important;
padding: 8px 16px !important;
border: 1px solid transparent;
border-radius: 0;
background: transparent !important;
box-shadow: none;
outline: 0;
color: ${themeVars.color.text.light.num1};
font-size: 14px;
line-height: 21px;
font-weight: 400;
}
& .switch .item:not(.active):hover {
color: ${themeVars.color.text.self};
}
& .switch .item.active {
border-right-color: ${themeVars.color.light.border};
border-left-color: ${themeVars.color.light.border};
border-bottom-color: ${themeVars.color.body};
background: ${themeVars.color.body} !important;
color: ${themeVars.color.text.self};
}
/* The editor's own border already draws the first tab's left edge. */
& .switch .item.active:first-child {
border-left-color: transparent;
border-top-left-radius: ${otherThemeVars.border.radius};
}
& .switch .item:focus-visible {
outline: 2px solid ${themeVars.github.fgColor.accent};
outline-offset: -2px;
}
& .switch .item.active::before,
& .switch .item.active::after {
display: none;
}
}
& > .ui.tab.markup {
background: ${themeVars.color.body};
padding: 16px;
min-height: 136px;
font-size: 14px;
line-height: 21px;
}
& textarea {
margin: 8px;
width: calc(100% - 16px);
height: auto;
min-height: 123px;
max-height: calc(35lh + 18px);
field-sizing: content;
line-height: 21px;
font-family: var(--fonts-proportional);
padding: 8px;
}
`;

/** The attachment line under an editor, for the rules of its `.dropzone`: a plain text button instead of a dashed drop area. */
export const attachmentDropzone = `
min-height: 32px;
padding: 0;
border: 0;
background: transparent;
& .dz-message {
margin: 0;
text-align: left;
}
& .dz-button {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 6px 8px;
min-height: 32px;
font-size: 12px;
line-height: 18px;
font-weight: 400;
color: ${themeVars.color.text.light.num1};
background: transparent;
border: 0;
box-shadow: none;
}
`;
2 changes: 2 additions & 0 deletions styles/components/issues/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import issueList from "./issue_list";
import issueOverview from "./issue_overview";
import issueSidebar from "./issue_sidebar";
import issueTimeline from "./issue_timeline";
import pullFilesReview from "./pull_files_review";
import pullReview from "./pull_review";

export default cssCombine(
Expand All @@ -34,6 +35,7 @@ export default cssCombine(
issueOverview,
issueConversation,
pullReview,
pullFilesReview,
issueSidebar,
issueTimeline
);
123 changes: 3 additions & 120 deletions styles/components/issues/issue_conversation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { css, otherThemeVars, themeVars } from "@lutinglt/gitea-github-theme/core";
import { attachmentDropzone, markdownEditor } from "./editor";

export default css`
.page-content.repository.view.issue.github-conversation {
Expand Down Expand Up @@ -453,128 +454,10 @@ export default css`
}
}
& .combo-markdown-editor {
border: 1px solid ${themeVars.color.light.border};
border-radius: ${otherThemeVars.border.radius};
background: ${themeVars.color.body};
& markdown-toolbar {
background: ${themeVars.color.box.header};
border-bottom: 1px solid ${themeVars.color.light.border};
}
& .markdown-toolbar-button {
color: ${themeVars.color.text.light.num1};
width: 28px;
height: 28px;
padding: 6px;
border: 0;
background: transparent;
}
& textarea {
background: ${themeVars.color.body};
font-size: 14px;
border: 1px solid ${themeVars.color.light.border};
border-radius: ${otherThemeVars.border.radius};
box-shadow: none;
}
overflow: visible;

& markdown-toolbar {
border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0;
min-height: 38px;
padding: 0 8px 0 0;
gap: 8px;

& .markdown-toolbar-group {
flex: 0 0 auto;
}
& .switch {
border: 0;
background: transparent;
border-radius: 0;
margin: 0 auto -1px 0;
min-height: 38px;
}
/* Forgejo overlaps neighbouring switch items with negative margins and paints the first one. */
& .switch .item {
height: 38px;
min-height: 38px;
margin: 0 !important;
padding: 8px 16px !important;
border: 1px solid transparent;
border-radius: 0;
background: transparent !important;
box-shadow: none;
outline: 0;
color: ${themeVars.color.text.light.num1};
font-size: 14px;
line-height: 21px;
font-weight: 400;
}
& .switch .item:not(.active):hover {
color: ${themeVars.color.text.self};
}
& .switch .item.active {
border-right-color: ${themeVars.color.light.border};
border-left-color: ${themeVars.color.light.border};
border-bottom-color: ${themeVars.color.body};
background: ${themeVars.color.body} !important;
color: ${themeVars.color.text.self};
}
/* The editor's own border already draws the first tab's left edge. */
& .switch .item.active:first-child {
border-left-color: transparent;
border-top-left-radius: ${otherThemeVars.border.radius};
}
& .switch .item:focus-visible {
outline: 2px solid ${themeVars.github.fgColor.accent};
outline-offset: -2px;
}
& .switch .item.active::before,
& .switch .item.active::after {
display: none;
}
}
& > .ui.tab.markup {
background: ${themeVars.color.body};
padding: 16px;
min-height: 136px;
font-size: 14px;
line-height: 21px;
}
& textarea {
margin: 8px;
width: calc(100% - 16px);
height: auto;
min-height: 123px;
max-height: calc(35lh + 18px);
field-sizing: content;
line-height: 21px;
font-family: var(--fonts-proportional);
padding: 8px;
}
${markdownEditor}
}
& .dropzone {
min-height: 32px;
padding: 0;
border: 0;
background: transparent;
& .dz-message {
margin: 0;
text-align: left;
}
& .dz-button {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 6px 8px;
min-height: 32px;
font-size: 12px;
line-height: 18px;
font-weight: 400;
color: ${themeVars.color.text.light.num1};
background: transparent;
border: 0;
box-shadow: none;
}
${attachmentDropzone}
}
}

Expand Down
Loading
Loading