Skip to content

Commit

Permalink
Show lock icon for Leetcode Premium questions (#19)
Browse files Browse the repository at this point in the history
* Add lock icon to signify leetcode premium questions

Fixes #11

* Add `Premium` field to each question

This new field will represent whether or not a question requires
leetcode premium to view, and also allow users to filter by all,
premium, or free questions.

* Move Premium to its own column
  • Loading branch information
Sean committed Jun 5, 2020
1 parent ce12d85 commit 4af578f
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from 'reactstrap';
import ReactTooltip from 'react-tooltip';
import { useTable, useFilters, useSortBy } from 'react-table';
import { FaQuestionCircle } from 'react-icons/fa';
import { FaQuestionCircle, FaLock } from 'react-icons/fa';
import { Event } from '../Shared/Tracking';

import questionList from '../../data';
Expand Down Expand Up @@ -67,6 +67,22 @@ const Table = () => {
);
},
},
{
id: 'Premium',
Cell: cellInfo => {
return (
<span>
{cellInfo.row.original.premium ? (
<span data-tip="Requires leetcode premium">
<FaLock />{' '}
</span>
) : (
''
)}
</span>
);
},
},
{
Header: 'Name',
accessor: 'name',
Expand Down
Loading

0 comments on commit 4af578f

Please sign in to comment.