You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.6 KiB
61 lines
1.6 KiB
3 years ago
|
import React from 'react';
|
||
|
|
||
|
import QuestionGroups from './QuestionGroups.json';
|
||
|
|
||
2 years ago
|
function DifficultyLabel({ difficulty }) {
|
||
3 years ago
|
return (
|
||
|
<span
|
||
|
style={{
|
||
|
fontWeight: 600,
|
||
|
color: {
|
||
|
Easy: 'rgb(0, 184, 163)',
|
||
|
Medium: 'rgb(255, 192, 30)',
|
||
|
Hard: 'rgb(255, 55, 95)',
|
||
|
}[difficulty],
|
||
|
}}>
|
||
|
{difficulty}
|
||
|
</span>
|
||
|
);
|
||
|
}
|
||
|
|
||
3 years ago
|
export default function QuestionList() {
|
||
|
return (
|
||
|
<div className="padding-vert--lg">
|
||
|
{Object.entries(QuestionGroups).map(
|
||
|
([sectionTitle, questions], index) => (
|
||
|
<div className="margin-bottom--lg" key={sectionTitle}>
|
||
|
<h4>Week {index + 5}</h4>
|
||
|
<table>
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Problem</th>
|
||
|
<th>Difficulty</th>
|
||
|
<th>Duration</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
{questions.map((question) => (
|
||
|
<tr key={question.slug}>
|
||
|
<td>
|
||
|
<a
|
||
|
href={question.url}
|
||
|
target="_blank"
|
||
|
rel="noopener noreferer">
|
||
|
{question.title}
|
||
|
</a>
|
||
|
</td>
|
||
3 years ago
|
<td>
|
||
|
<DifficultyLabel difficulty={question.difficulty} />
|
||
|
</td>
|
||
3 years ago
|
<td>{question.duration} mins</td>
|
||
|
</tr>
|
||
|
))}
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
),
|
||
|
)}
|
||
|
</div>
|
||
|
);
|
||
|
}
|