Skip to content

Commit 8e10337

Browse files
committed
feat: add min presence ahead example (#2491)
* feat: add min presence ahead example * chore: add changeset
1 parent 746038d commit 8e10337

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

.changeset/famous-lamps-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@react-pdf/examples': minor
3+
---
4+
5+
feat: add minPresenceAhead example

packages/examples/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ module.exports = {
33
rules: {
44
'react/prop-types': 0,
55
'jsx-a11y/anchor-is-valid': 0,
6+
'react/jsx-one-expression-per-line': 0,
67
},
78
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React from 'react';
2+
import { Document, Page, View, Text } from '@react-pdf/renderer';
3+
4+
const palette = [
5+
'#781c81',
6+
'#521b80',
7+
'#442f8b',
8+
'#3f4c9f',
9+
'#4069b4',
10+
'#4582c1',
11+
'#4e96bd',
12+
'#5aa6a9',
13+
'#68b090',
14+
'#7ab878',
15+
'#8dbc64',
16+
'#a2be56',
17+
];
18+
19+
const MinPresenceAhead = () => (
20+
<Document>
21+
<Page style={{ padding: 20 }}>
22+
{palette.map((color, i) => {
23+
const minPresenceAhead = i === 8 ? 82 : 0;
24+
25+
return (
26+
<View
27+
key={color}
28+
wrap={false}
29+
minPresenceAhead={i === 8 ? 90 : 0}
30+
style={{
31+
width: '100%',
32+
height: 80,
33+
color: 'white',
34+
backgroundColor: color,
35+
}}
36+
>
37+
<Text>Index: {i}</Text>
38+
<Text>MinPresenceAhead: {minPresenceAhead}</Text>
39+
</View>
40+
);
41+
})}
42+
</Page>
43+
</Document>
44+
);
45+
46+
export default MinPresenceAhead;

0 commit comments

Comments
 (0)