|
1 | 1 | import { ExternalLinkIcon } from '@heroicons/react/solid';
|
2 |
| -import Tippy from '@tippyjs/react'; |
3 |
| -import { navigate } from 'gatsby'; |
4 | 2 | import * as React from 'react';
|
5 | 3 | import { Instance } from 'tippy.js';
|
6 | 4 | import { useDarkMode } from '../../context/DarkModeContext';
|
7 | 5 | import { useMarkdownProblemLists } from '../../context/MarkdownProblemListsContext';
|
8 | 6 | import { getProblemURL, ProblemInfo } from '../../models/problem';
|
9 |
| -import FocusProblemDropdown from './FocusProblemDropdown'; |
| 7 | +import ProblemsListItemDropdown from './ProblemsList/ProblemsListItemDropdown'; |
10 | 8 | import ProblemStatusCheckbox from './ProblemsList/ProblemStatusCheckbox';
|
11 | 9 |
|
12 | 10 | export default function FocusProblem({
|
@@ -34,57 +32,6 @@ export default function FocusProblem({
|
34 | 32 | const tippyRef = React.useRef<Instance>();
|
35 | 33 | const [isDropdownShown, setIsDropdownShown] = React.useState(false);
|
36 | 34 |
|
37 |
| - const more = ( |
38 |
| - <div> |
39 |
| - <Tippy |
40 |
| - onCreate={tippy => (tippyRef.current = tippy)} |
41 |
| - content={ |
42 |
| - isDropdownShown ? ( |
43 |
| - <FocusProblemDropdown |
44 |
| - onShowSolutionSketch={(problem: ProblemInfo) => { |
45 |
| - return problem; |
46 |
| - }} |
47 |
| - problem={problem} |
48 |
| - showTags={true} |
49 |
| - showDifficulty={true} |
50 |
| - onViewProblemSolutions={() => { |
51 |
| - tippyRef.current.hide(); |
52 |
| - navigate('/problem-solutions/', { |
53 |
| - state: { |
54 |
| - problem, |
55 |
| - }, |
56 |
| - }); |
57 |
| - }} |
58 |
| - /> |
59 |
| - ) : ( |
60 |
| - '' |
61 |
| - ) |
62 |
| - } |
63 |
| - theme={darkMode ? 'dark' : 'light'} |
64 |
| - placement="bottom-end" |
65 |
| - arrow={true} |
66 |
| - animation="fade" |
67 |
| - trigger="click" |
68 |
| - interactive={true} |
69 |
| - onShow={() => setIsDropdownShown(true)} |
70 |
| - onHidden={() => setIsDropdownShown(false)} |
71 |
| - > |
72 |
| - <button className="focus:outline-none w-8 h-8 inline-flex items-center justify-center text-gray-400 rounded-full bg-transparent hover:text-gray-500 dark:hover:text-gray-300"> |
73 |
| - {/* Heroicon name: solid/dots-vertical */} |
74 |
| - <svg |
75 |
| - className="w-5 h-5" |
76 |
| - xmlns="http://www.w3.org/2000/svg" |
77 |
| - viewBox="0 0 20 20" |
78 |
| - fill="currentColor" |
79 |
| - aria-hidden="true" |
80 |
| - > |
81 |
| - <path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" /> |
82 |
| - </svg> |
83 |
| - </button> |
84 |
| - </Tippy> |
85 |
| - </div> |
86 |
| - ); |
87 |
| - |
88 | 35 | // transform must go in the isHovered condition
|
89 | 36 | // See https://github.com/thecodingwizard/usaco-guide/issues/198
|
90 | 37 | // transform creates a new stacking context :(
|
@@ -125,7 +72,17 @@ export default function FocusProblem({
|
125 | 72 | </div>
|
126 | 73 | </div>
|
127 | 74 | <div className="flex-shrink-0 flex items-center justify-center mt-1 sm:mr-2 ml-2">
|
128 |
| - {more} |
| 75 | + <div className="mr-2"> |
| 76 | + <ProblemsListItemDropdown |
| 77 | + onShowSolutionSketch={(problem: ProblemInfo) => { |
| 78 | + return problem; |
| 79 | + }} |
| 80 | + problem={problem} |
| 81 | + showTags={true} |
| 82 | + showDifficulty={true} |
| 83 | + isFocusProblem={true} |
| 84 | + /> |
| 85 | + </div> |
129 | 86 | <ProblemStatusCheckbox problem={problem} size="large" />
|
130 | 87 | </div>
|
131 | 88 | </div>
|
|
0 commit comments