-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathparser.ts
More file actions
30 lines (23 loc) · 631 Bytes
/
Copy pathparser.ts
File metadata and controls
30 lines (23 loc) · 631 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Params, Sections } from 'types';
import { getBorderUrl } from 'utils/getBorderUrl';
type Borders = Parameters<typeof getBorderUrl>[0];
type Content = {
provider: Borders;
borders: {
[key in Borders]: Params;
};
};
type BorderSectionParserArgs = {
content: Content;
styles: object;
};
const borderSectionParser = ({ content }: BorderSectionParserArgs) => {
const { borders, provider } = content;
const url = getBorderUrl(provider, borders[provider]);
return `
<div data-importer="${Sections.BORDER}">
<img style="100%" src="${url}" />
</div>
`;
};
export { borderSectionParser };