Skip to content

Commit 7c81306

Browse files
committed
add tringle
1 parent e592a34 commit 7c81306

File tree

3 files changed

+43
-40
lines changed

3 files changed

+43
-40
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/Dependencies/AddFont/FontPicker/List.tsx

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useMemo } from 'react';
22
import { Font } from '@samuelmeuli/font-manager';
3-
import { List, SearchFonts, FontLI, FontFamily } from './elements';
3+
import { List, SearchFonts, FontLI, FontFamily, Arrow } from './elements';
44

55
type Props = {
66
fonts: Font[];
@@ -30,27 +30,30 @@ const FontList = ({
3030
[fonts, searchTerm]
3131
);
3232
return (
33-
<List expanded={expanded}>
34-
<SearchFonts
35-
type="text"
36-
value={searchTerm}
37-
onChange={updateSearch}
38-
placeholder="Search Typefaces"
39-
/>
40-
{getFonts.map((font: Font) => (
41-
<FontLI key={font.family}>
42-
<FontFamily
43-
type="button"
44-
id={`font-button-${getFontId(font.family)}`}
45-
active={font.family === activeFontFamily}
46-
onClick={onSelection}
47-
onKeyPress={onSelection}
48-
>
49-
{font.family}
50-
</FontFamily>
51-
</FontLI>
52-
))}
53-
</List>
33+
<>
34+
<Arrow />
35+
<List expanded={expanded}>
36+
<SearchFonts
37+
type="text"
38+
value={searchTerm}
39+
onChange={updateSearch}
40+
placeholder="Search Typefaces"
41+
/>
42+
{getFonts.map((font: Font) => (
43+
<FontLI key={font.family}>
44+
<FontFamily
45+
type="button"
46+
id={`font-button-${getFontId(font.family)}`}
47+
active={font.family === activeFontFamily}
48+
onClick={onSelection}
49+
onKeyPress={onSelection}
50+
>
51+
{font.family}
52+
</FontFamily>
53+
</FontLI>
54+
))}
55+
</List>
56+
</>
5457
);
5558
};
5659

packages/app/src/app/pages/Sandbox/Editor/Workspace/Dependencies/AddFont/FontPicker/elements.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,9 @@ export const List = styled.ul<{ expanded?: boolean }>`
7070
text-align: left;
7171
display: none;
7272
margin-top: 0.5rem;
73-
position: relative;
74-
75-
&:before {
76-
content: '';
77-
width: 0;
78-
height: 0;
79-
border-style: solid;
80-
border-width: 0 3px 6px 3px;
81-
border-color: transparent transparent #007bff transparent;
82-
position: absolute;
83-
top: 0;
84-
left: 50%;
85-
transform: translateX(-50%) translateY(-100%);
86-
}
73+
background-color: ${props => props.theme['sideBar.background']};
74+
position: absolute;
75+
z-index: 10;
8776
8877
${props =>
8978
props.expanded &&
@@ -99,10 +88,7 @@ export const SelectedFont = styled.button<{ done?: boolean }>`
9988
color: ${props =>
10089
props.theme['input.foreground'] ||
10190
(props.theme.light ? '#636363' : 'white')};
102-
border-color: ${props =>
103-
Color(props.theme['input.background'])
104-
.darken(props.theme.light ? 0.1 : 0.3)
105-
.rgbString()};
91+
border-color: ${props => makeDarker(props)};
10692
10793
box-shadow: none;
10894
text-align: left;
@@ -127,3 +113,16 @@ export const SelectedFont = styled.button<{ done?: boolean }>`
127113
}
128114
`}
129115
`;
116+
117+
export const Arrow = styled.div`
118+
width: 0;
119+
height: 0;
120+
border-style: solid;
121+
border-width: 0 6px 6px 6px;
122+
border-color: transparent transparent
123+
${props => props.theme['sideBar.background']} transparent;
124+
position: absolute;
125+
margin-top: 2px;
126+
left: 50%;
127+
margin-left: -6px;
128+
`;

packages/app/src/app/pages/Sandbox/Editor/Workspace/Dependencies/AddFont/elements.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import styled from 'styled-components';
22

33
export const Container = styled.div`
44
margin: 0.5rem 1rem;
5+
position: relative;
56
`;

0 commit comments

Comments
 (0)