Skip to content

Commit 7ed48e6

Browse files
committed
fix project name preview overlap
1 parent afe7fa7 commit 7ed48e6

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

src/components/codeKeywords/keywordSelector.tsx

+3-19
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
KeywordIndicator,
2222
KeywordSearchInput,
2323
PositionWrapper,
24+
ProejectPreview,
2425
Selections,
2526
} from './styles.css';
2627
import {dropdownPopperOptions} from './utils';
@@ -150,26 +151,9 @@ export function KeywordSelector({keyword, group, index}: KeywordSelectorProps) {
150151
</Keyword>
151152
</AnimatePresence>
152153
{!isOpen && currentSelection?.title && (
153-
<div
154-
className="no-copy"
155-
style={{
156-
position: 'absolute',
157-
top: '-24px',
158-
left: '50%',
159-
transform: 'translateX(-50%)',
160-
fontSize: '12px',
161-
backgroundColor: '#333',
162-
color: '#fff',
163-
padding: '2px 6px',
164-
borderRadius: '3px',
165-
pointerEvents: 'none',
166-
whiteSpace: 'nowrap',
167-
opacity: 0.9,
168-
userSelect: 'none',
169-
}}
170-
>
154+
<ProejectPreview className="no-copy">
171155
{currentSelection.title}
172-
</div>
156+
</ProejectPreview>
173157
)}
174158
</span>
175159
</KeywordDropdown>

src/components/codeKeywords/styles.css.ts

+20-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ import {ArrowDown} from 'react-feather';
44
import styled from '@emotion/styled';
55
import {motion} from 'framer-motion';
66

7+
export const ProejectPreview = styled('div')`
8+
position: absolute;
9+
top: -24px;
10+
left: 50%;
11+
transform: translateX(-50%);
12+
font-size: 12px;
13+
background-color: rgba(51, 51, 51, 1);
14+
color: #fff;
15+
padding: 2px 6px;
16+
border-radius: 3px;
17+
pointer-events: none;
18+
white-space: nowrap;
19+
opacity: 0.9;
20+
user-select: none;
21+
`;
22+
723
export const PositionWrapper = styled('div')`
824
z-index: 100;
925
`;
@@ -92,8 +108,8 @@ export const ItemButton = styled('button')<{dark: boolean; isActive: boolean}>`
92108
color: #EBE6EF;
93109
`
94110
: `
95-
96-
111+
112+
97113
&:focus {
98114
outline: none;
99115
background-color: ${p.dark ? 'var(--gray-a4)' : 'var(--accent-purple-light)'};
@@ -141,6 +157,8 @@ export const KeywordIndicator = styled(ArrowDown, {
141157
export const KeywordSpan = styled(motion.span)`
142158
grid-row: 1;
143159
grid-column: 1;
160+
display: inline-block;
161+
margin-top: 24px;
144162
`;
145163

146164
export const KeywordSearchInput = styled('input')<{dark: boolean}>`

0 commit comments

Comments
 (0)