Skip to content

Commit 97310e7

Browse files
committed
Line height configurable by css var
1 parent 7049ae0 commit 97310e7

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

packages/feedback-components/src/feedback/feedback.module.sass

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
:root
2+
--text-line-height: 3em
3+
14
.feedback-component
25
position: relative
36
width: 800px
@@ -75,6 +78,7 @@ mark
7578
position: relative
7679
z-index: 0
7780
overflow: visible
81+
line-height: var(--text-line-height)
7882

7983
.type-container
8084
display: flex

packages/feedback-components/src/feedback/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export function FeedbackComponent({
5959
entityTypes,
6060
matchComponent,
6161
onSave,
62-
lineHeight = 3,
6362
allowOverlap,
6463
}) {
6564
// Get the input arguments
@@ -91,7 +90,6 @@ export function FeedbackComponent({
9190
// @ts-ignore
9291
nodes: tree,
9392
selectedNodes,
94-
lineHeight: `${lineHeight}em`,
9593
allowOverlap,
9694
}),
9795
),

packages/feedback-components/src/feedback/text-visualizer.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function isHighlighted(tag: Highlight, selectedNodes: number[]) {
7373

7474
export function FeedbackText(props: FeedbackTextProps) {
7575
// Convert input to tags
76-
const { text, selectedNodes, nodes, dispatch, lineHeight, allowOverlap } =
76+
const { text, selectedNodes, nodes, dispatch, allowOverlap } =
7777
props;
7878
const allTags: AnnotateBlendTag[] = buildTags(
7979
buildHighlights(nodes, null),
@@ -96,7 +96,6 @@ export function FeedbackText(props: FeedbackTextProps) {
9696
h(HighlightedText, {
9797
text,
9898
allTags,
99-
lineHeight,
10099
allowOverlap,
101100
dispatch,
102101
selectedNodes,
@@ -294,7 +293,6 @@ export function HighlightedText(props: {
294293
const {
295294
text,
296295
allTags = [],
297-
lineHeight,
298296
dispatch,
299297
selectedNodes,
300298
allowOverlap,
@@ -319,7 +317,7 @@ export function HighlightedText(props: {
319317

320318
return h(
321319
"span",
322-
{ style: { lineHeight }, ref: spanRef },
320+
{ ref: spanRef },
323321
tree.children.map((child: any, i: number) =>
324322
renderNode(child, dispatch, selectedNodes, false),
325323
),

packages/feedback-components/stories/feedback.stories.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FeedbackComponent } from "../src";
44
import { data, entityTypes, data2, data3, entityTypes2 } from "./test-data";
55
import h from "@macrostrat/hyper";
66

7-
function FeedbackInterface({ data, types, lineHeight, allowOverlap }) {
7+
function FeedbackInterface({ data, types, allowOverlap }) {
88
const { entities = [], paragraph_text, model, model_run, source_text } = data;
99

1010
return h(FeedbackComponent, {
@@ -14,7 +14,6 @@ function FeedbackInterface({ data, types, lineHeight, allowOverlap }) {
1414
entityTypes: createMap(types),
1515
sourceTextID: source_text,
1616
runID: model_run,
17-
lineHeight,
1817
allowOverlap,
1918
});
2019
}
@@ -39,7 +38,6 @@ export const NoAllowOverlap: StoryObj<{}> = {
3938
args: {
4039
data,
4140
types: entityTypes,
42-
lineHeight: 2,
4341
allowOverlap: false,
4442
},
4543
};
@@ -48,7 +46,6 @@ export const TestData2: StoryObj<{}> = {
4846
args: {
4947
data: data2,
5048
types: entityTypes2,
51-
lineHeight: 2,
5249
allowOverlap: false,
5350
},
5451
};
@@ -57,7 +54,6 @@ export const TestData3: StoryObj<{}> = {
5754
args: {
5855
data: data3,
5956
types: entityTypes2,
60-
lineHeight: 2,
6157
allowOverlap: true,
6258
},
6359
};

0 commit comments

Comments
 (0)