Skip to content

Commit 918fa56

Browse files
committed
docs: create component for rendering screenshots
1 parent b39dbaf commit 918fa56

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import * as styles from './styles.module.scss';
3+
4+
interface ScreenshotProps {
5+
alt?: string;
6+
src: string;
7+
}
8+
9+
export const Screenshot = ({ alt, src }: ScreenshotProps) => {
10+
return (
11+
<div className={styles.screenshot} style={{ textAlign: 'center'}}>
12+
<img
13+
alt={alt}
14+
src={src}
15+
style={{ border: 'none' }}
16+
width="100%"
17+
/>
18+
</div>
19+
);
20+
};
21+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@import "../../../static/styles/variables.scss";
2+
3+
.screenshot {
4+
position: relative;
5+
display: inline-block;
6+
text-align: center;
7+
padding-top: calc(1vw + 1.5rem);
8+
background: #ccc linear-gradient(#ddd, #bbb 4vw, #eee 4.15vw);
9+
border-radius: .4vw .4vw 0 0;
10+
width: 50vw;
11+
/*width: 100vh;*/
12+
max-width: 100%;
13+
//height: 35vw;
14+
15+
&:before {
16+
content: "•••";
17+
position: absolute;
18+
top: 0;
19+
left: 0.5vw;
20+
font-size: 3.2vw;
21+
line-height: 2vw;
22+
color: #ddd;
23+
//letter-spacing: .3vw;
24+
}
25+
26+
> img {
27+
margin: 0 !important;
28+
display: block;
29+
width: 400%;
30+
//margin: -46.5vw 0 0 -150%;
31+
border: 0;
32+
//height: calc(4 * (35vw - 4vw));
33+
//transform: scale(.25);
34+
}
35+
}

docs/src/templates/DocTemplate.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { ParameterTable } from '../components/ReferenceDocs/ParameterTable';
4646
import { Snippet, SnippetGroup } from '../components/Snippets/SnippetGroup';
4747
import { CodeTabs } from '../components/CodeTabs';
4848
import InlineButton from '../components/InlineButton/InlineButton';
49+
import { Screenshot } from '../components/Screenshot';
4950

5051
const MyH4: React.FC<{ children: string }> = ({ children }) => {
5152
return (<h4 id={kebabCase(children)} name={kebabCase(children)}>{children}</h4>);
@@ -70,6 +71,7 @@ const components = {
7071
h4: MyH4,
7172
CodeTabs,
7273
Btn: InlineButton,
74+
Screenshot,
7375
};
7476

7577
const MDX = (props) => (

0 commit comments

Comments
 (0)