mirror of
https://github.com/status-im/ETHReport.git
synced 2025-02-01 09:06:32 +00:00
Updating search results
This commit is contained in:
parent
33469cd86c
commit
bd7a3d5b14
@ -0,0 +1,13 @@
|
|||||||
|
@mixin hasRedUnderline() {
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
width: 100%;
|
||||||
|
height: calculateRem(1);
|
||||||
|
background-color: $red;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,6 @@ $primary-font: 'Roboto Mono', monospace;
|
|||||||
$secondary-font: 'bebas_neuebold', sans-serif;
|
$secondary-font: 'bebas_neuebold', sans-serif;
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
$container-width: 750;
|
$container-width: 600;
|
||||||
$browse-left-width: 180;
|
$browse-left-width: 180;
|
||||||
$container-padding: 24;
|
$container-padding: 24;
|
||||||
|
@ -27,7 +27,7 @@ const SearchResults = (props) => {
|
|||||||
return text.replace(regex, `<span>${cleanTerm}</span>`);
|
return text.replace(regex, `<span>${cleanTerm}</span>`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const processText = (text, length = 1500) => highlightTerm(trimText(text, length));
|
const processText = (text, length = 500) => highlightTerm(trimText(text, length));
|
||||||
|
|
||||||
const findFirstQuestion = (interview) => {
|
const findFirstQuestion = (interview) => {
|
||||||
let { answer } = interview.interview[interview.matchedIndex];
|
let { answer } = interview.interview[interview.matchedIndex];
|
||||||
@ -48,6 +48,10 @@ const SearchResults = (props) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const interviewNameContainsTerm = (name, searchTerm) => {
|
||||||
|
return name.toLowerCase().includes(searchTerm.toLowerCase());
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="search-results">
|
<div className="search-results">
|
||||||
<ul>
|
<ul>
|
||||||
@ -58,12 +62,15 @@ const SearchResults = (props) => {
|
|||||||
key={interview.id}
|
key={interview.id}
|
||||||
onClick={props.toggleSingleInterview}
|
onClick={props.toggleSingleInterview}
|
||||||
>
|
>
|
||||||
<h3>{ interview.name }</h3>
|
<h3 className={interviewNameContainsTerm(interview.name, props.term) ? 'matched-name' : ''}>
|
||||||
|
{ Parser(interview.name) }
|
||||||
|
</h3>
|
||||||
<h5>{interview.matchedIndex + 1})
|
<h5>{interview.matchedIndex + 1})
|
||||||
{ findFirstQuestion(interview).question }
|
{ findFirstQuestion(interview).question }
|
||||||
</h5>
|
</h5>
|
||||||
<p>{ Parser(findFirstQuestion(interview).answer) }
|
<div>
|
||||||
</p>
|
{ Parser(findFirstQuestion(interview).answer) }
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,15 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
font-size: calculateRem(18);
|
font-size: calculateRem(24);
|
||||||
margin-bottom: calculateRem(8);
|
margin-bottom: calculateRem(8);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
&.matched-name {
|
||||||
|
@include hasRedUnderline;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h5 {
|
h5 {
|
||||||
@ -20,6 +26,7 @@
|
|||||||
|
|
||||||
p {
|
p {
|
||||||
font-size: calculateRem(14);
|
font-size: calculateRem(14);
|
||||||
|
display: inline;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user