Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: OPTIC-1151: Extract font family to a constant #6424

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion label_studio/core/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ html {
}

body {
font-family: 'Figtree', sans-serif !important;
--font-family: 'Figtree', sans-serif !important;
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved

--sand_900: #12110D;
--sand_800: #262522;
Expand Down
2 changes: 1 addition & 1 deletion web/apps/labelstudio/src/app/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body {
--menu-sidebar-width: 240px;

margin: 0;
font-family: Figtree, sans-serif;
font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
}

.app-wrapper {
Expand Down
6 changes: 4 additions & 2 deletions web/apps/labelstudio/src/components/Error/Error.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
margin: 15px 0;
}

&__stracktrace {
&__stacktrace {
--font-family: monaco, monospace;
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved

margin: 16px 0;
padding: 16px;
overflow: auto;
Expand All @@ -43,7 +45,7 @@
white-space: pre;
border-radius: 5px;
background-color: var(--sand_100);
font-family: Monaco, monospace;
font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
}

&__version {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.select-ls {
position: relative;
font-family: Figtree, sans-serif;

--font-family: figtree, sans-serif;
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved

&__list {
top: 0;
Expand Down Expand Up @@ -35,6 +36,8 @@
select:disabled {
background: var(--sand_200);
color: var(--sand_500);
font-family: Figtree, sans-serif;

--font-family: figtree, sans-serif;
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved

opacity: 1;
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ $scroll-width: 5px;
textarea,
:global(.react-codemirror2) {
flex: 1;
font-family: monospace;

--font-family: monospace;

font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved

:global(.CodeMirror) {
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.CodeMirror-hints {
z-index: 3000;
}

.CodeMirror-hint-tag {
white-space: normal;
line-height: 1.4em;
Expand All @@ -9,19 +10,24 @@
overflow: hidden;
text-overflow: ellipsis;
}

.CodeMirror-hint-name {
font-family: monospace;
--font-family: monospace;

font-weight: 500;
color: darkgoldenrod;
font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
}

.CodeMirror-hint-active .CodeMirror-hint-name {
color: blanchedalmond;
}

.CodeMirror-hint-type {
font-style: italic;
color: #aaa;
}

.CodeMirror-hint-active .CodeMirror-hint-type {
color: #ddd;
}
.CodeMirror-hint-description {}
4 changes: 3 additions & 1 deletion web/libs/editor/src/assets/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
}

.react-dropdown-tree-select .node > .toggle {
font-family: monospace;
--font-family: monospace;

font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
font-style: normal;
color: initial;
cursor: pointer;
Expand Down
3 changes: 2 additions & 1 deletion web/libs/editor/src/components/Settings/Settings.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
%settings-title {
font-family: Figtree, sans-serif;
--font-family: Figtree, sans-serif;
font-size: 16px;
font-weight: 500;
line-height: 24px;
letter-spacing: 0.15px;
text-align: left;
font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@

.relations {
&__view-control {
--font-family: Roboto, Arial, sans-serif;
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
display: grid;
grid-auto-flow: column;
grid-auto-columns: min-content;
align-items: center;
grid-column-gap: 4px;
text-wrap: nowrap;
padding: 4px;
font-family: Roboto, Arial, sans-serif;
font-weight: 500;
font-size: 15px;
font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
}
}
3 changes: 2 additions & 1 deletion web/libs/editor/src/components/Taxonomy/Taxonomy.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
}

.taxonomy__grouping {
font-family: monospace;
--font-family: monospace;
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
font-size: 16px;
display: inline-block;
width: 24px;
Expand All @@ -162,6 +162,7 @@
user-select: none;
flex-shrink: 0;
pointer-events: all;
font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved

svg {
transition: transform 0.1s; // visible rotation of arrow
Expand Down
3 changes: 2 additions & 1 deletion web/libs/editor/src/mixins/HighlightMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,11 @@ const createSpanStylesheet = (document, identifier, color) => {
`,
// @todo this style was applied in old RichText only
[`${className}[data-label]::after`]: `
--font-family: Monaco;
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
padding: 2px 2px;
font-size: 9.5px;
font-weight: bold;
font-family: Monaco;
font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
vertical-align: super;
content: attr(data-label);
line-height: 0;
Expand Down
3 changes: 2 additions & 1 deletion web/libs/editor/src/tags/object/RichText/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ const Model = types
}
.htx-highlight[data-index]::after,
.htx-highlight[data-label]::after {
--font-family: Monaco;
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
padding: 2px 2px;
font-size: 9.5px;
font-weight: bold;
font-family: Monaco;
font-family: var(--font-family);
yyassi-heartex marked this conversation as resolved.
Show resolved Hide resolved
vertical-align: super;
content: attr(data-label);
line-height: 0;
Expand Down
8 changes: 4 additions & 4 deletions web/libs/editor/src/utils/__tests__/canvas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ const svgs = {
simple: [
"'data:image/svg+xml,",
'%3Csvg xmlns="http://www.w3.org/2000/svg" height="16" width="2"%3E',
'%3Ctext x="0" y="11" style="font-size: 9.5px; font-weight: bold; font-family: Monaco"%3E',
'%3Ctext x="0" y="11" style="font-size: 9.5px; font-weight: bold; --font-family: Monaco; font-family: var(--font-family);"%3E',
"Test Label",
"%3C/text%3E%3C/svg%3E'",
].join(""),
complex: [
"'data:image/svg+xml,",
'%3Csvg xmlns="http://www.w3.org/2000/svg" height="16" width="2"%3E',
'%3Ctext x="0" y="11" style="font-size: 9.5px; font-weight: bold; font-family: Monaco"%3E',
'%3Ctext x="0" y="11" style="font-size: 9.5px; font-weight: bold; --font-family: Monaco; font-family: var(--font-family);"%3E',
"A</text%3E B",
"%3C/text%3E%3C/svg%3E'",
].join(""),
score: [
"'data:image/svg+xml,",
'%3Csvg xmlns="http://www.w3.org/2000/svg" height="16" width="28"%3E',
'%3Crect x="0" y="0" rx="2" ry="2" width="24" height="14" style="fill:%237ca91f;opacity:0.5" /%3E',
'%3Ctext x="3" y="10" style="font-size: 8px; font-family: Monaco"%3E0.60%3C/text%3E',
'%3Ctext x="26" y="11" style="font-size: 9.5px; font-weight: bold; font-family: Monaco"%3E',
'%3Ctext x="3" y="10" style="font-size: 8px; --font-family: Monaco; font-family: var(--font-family);"%3E0.60%3C/text%3E',
'%3Ctext x="26" y="11" style="font-size: 9.5px; font-weight: bold; --font-family: Monaco; font-family: var(--font-family);"%3E',
"Test Label",
"%3C/text%3E%3C/svg%3E'",
].join(""),
Expand Down
6 changes: 3 additions & 3 deletions web/libs/editor/src/utils/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ const labelToSVG = (() => {
const svg = document.createElement("svg");
const svgText = document.createElement("text");

svgText.style = "font-size: 9.5px; font-weight: bold; color: red; fill: red; font-family: Monaco";
svgText.style = "font-size: 9.5px; font-weight: bold; color: red; fill: red; --font-family: Monaco; font-family: var(--font-family);";
svgText.innerHTML = text;

svg.appendChild(svgText);
Expand All @@ -429,13 +429,13 @@ const labelToSVG = (() => {
const fillColor = Colors.getScaleGradient(score);

items.push(`<rect x="0" y="0" rx="2" ry="2" width="24" height="14" style="fill:${fillColor};opacity:0.5" />`);
items.push(`<text x="3" y="10" style="font-size: 8px; font-family: Monaco">${score.toFixed(2)}</text>`);
items.push(`<text x="3" y="10" style="font-size: 8px; --font-family: Monaco; font-family: var(--font-family);">${score.toFixed(2)}</text>`);
width = width + 26;
}

if (label) {
items.push(
`<text x="${width}" y="11" style="font-size: 9.5px; font-weight: bold; font-family: Monaco">${label}</text>`,
`<text x="${width}" y="11" style="font-size: 9.5px; font-weight: bold; --font-family: Monaco; font-family: var(--font-family);">${label}</text>`,
);
width = width + calculateTextWidth(label) + 2;
}
Expand Down
Loading