Skip to content

Commit 149c801

Browse files
authored
tweak(views): refine S-89 styles and typography
Co-authored-by: ux-git <ux-git@users.noreply.github.com>
1 parent 8ea4185 commit 149c801

File tree

8 files changed

+81
-31
lines changed

8 files changed

+81
-31
lines changed

public/assets/fonts/Inter-Bold.ttf

77.7 KB
Binary file not shown.
78 KB
Binary file not shown.
78.8 KB
Binary file not shown.

src/views/meetings/midweek/S89/4in1/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const TemplateS89Doc4in1 = ({ s89Data, lang }: S89Doc4in1Type) => {
4646
>
4747
{formatData().map((groupedData, groupedIndex) => {
4848
return (
49-
<Fragment key={groupedIndex}>
49+
<Fragment key={groupedData.map((d) => d.id).join('-')}>
5050
{groupedData.map((data, index) => (
5151
<View
5252
key={data.id}
@@ -86,11 +86,12 @@ const TemplateS89Doc4in1 = ({ s89Data, lang }: S89Doc4in1Type) => {
8686
aux_class_1={data.aux_class_1}
8787
aux_class_2={data.aux_class_2}
8888
/>
89+
</View>
8990

91+
<View style={styles.bottomSection}>
9092
<S89StudentNote lang={lang} />
93+
<S89Footer lang={lang} />
9194
</View>
92-
93-
<S89Footer lang={lang} />
9495
</View>
9596
))}
9697
</Fragment>

src/views/meetings/midweek/S89/default/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ const TemplateS89 = ({ data, lang }: S89Type) => {
5959
aux_class_1={data.aux_class_1}
6060
aux_class_2={data.aux_class_2}
6161
/>
62+
</View>
6263

64+
<View style={styles.bottomSection}>
6365
<S89StudentNote lang={lang} />
66+
<S89Footer lang={lang} />
6467
</View>
65-
66-
<S89Footer lang={lang} />
6768
</View>
6869
</Page>
6970
</Document>

src/views/meetings/midweek/S89/shared/S89StudentNote.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
1-
import { Text, View } from '@react-pdf/renderer';
1+
import { Text as PdfText, View } from '@react-pdf/renderer';
22
import { useAppTranslation } from '@hooks/index';
33
import { S89StudentNoteProps } from './index.types';
44
import styles from './index.styles';
55

6+
const RICH_TEXT_REGEX = /((?:<b>.*?<\/b>)|(?:<i>.*?<\/i>))/g;
7+
68
const S89StudentNote = ({ lang }: S89StudentNoteProps) => {
79
const { t } = useAppTranslation();
10+
const text = t('tr_s89DescFooter', { lng: lang });
11+
12+
const parts = text.split(RICH_TEXT_REGEX).filter(Boolean);
813

914
return (
1015
<View style={styles.studentNote}>
11-
<Text>{t('tr_s89DescFooter', { lng: lang })}</Text>
16+
<PdfText>
17+
{parts.map((part, index) => {
18+
let content = part;
19+
let style = {};
20+
21+
if (part.startsWith('<b>')) {
22+
content = part.replaceAll(/<\/?b>/g, '');
23+
style = { fontWeight: 700 };
24+
} else if (part.startsWith('<i>')) {
25+
content = part.replaceAll(/<\/?i>/g, '');
26+
style = { fontStyle: 'italic' };
27+
}
28+
29+
return (
30+
<PdfText key={`${index}-${part}`} style={style}>
31+
{content}
32+
</PdfText>
33+
);
34+
})}
35+
</PdfText>
1236
</View>
1337
);
1438
};

src/views/meetings/midweek/S89/shared/index.styles.ts

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ const styles = StyleSheet.create({
1313
height: '100%',
1414
},
1515
header: {
16-
fontWeight: 'bold',
16+
fontWeight: 800,
1717
marginBottom: '8px',
18-
lineHeight: 1.2,
18+
lineHeight: 1.1,
1919
textAlign: 'center',
20-
fontSize: '12px',
20+
fontSize: '11.5px',
21+
letterSpacing: -0.28,
2122
},
2223
details: {
2324
display: 'flex',
@@ -27,26 +28,27 @@ const styles = StyleSheet.create({
2728
detailsRow: {
2829
display: 'flex',
2930
flexDirection: 'row',
30-
gap: '5px',
31+
gap: '4px',
3132
alignItems: 'flex-end',
3233
},
3334
field: {
34-
fontWeight: 'bold',
35-
fontSize: '12px',
35+
fontWeight: 800,
36+
fontSize: '11px',
37+
paddingBottom: '2px',
3638
},
3739
fieldValue: {
3840
flex: '1 0 0',
3941
},
4042
fieldValueText: {
41-
marginBottom: '3px',
4243
paddingBottom: '1px',
43-
borderBottom: '1px dotted black',
44-
fontSize: '9px',
44+
paddingLeft: '5px',
45+
borderBottom: '1px dashed black',
46+
fontSize: '11px',
4547
},
4648
toBeGiven: {
47-
marginTop: '12px',
49+
marginTop: '16px',
4850
fontSize: '12px',
49-
fontWeight: 'bold',
51+
fontWeight: 800,
5052
},
5153
classes: {
5254
marginTop: '2px',
@@ -66,15 +68,24 @@ const styles = StyleSheet.create({
6668
fontWeight: 'normal',
6769
},
6870
studentNote: {
69-
fontSize: '9px',
70-
marginTop: '12px',
71+
fontSize: '8.5px',
72+
marginTop: '16px',
7173
lineHeight: 1.1,
74+
letterSpacing: -0.4,
75+
textAlign: 'justify',
76+
},
77+
bottomSection: {
78+
display: 'flex',
79+
flexDirection: 'column',
80+
gap: '10px',
81+
marginTop: 'auto',
7282
},
7383
footer: {
74-
fontSize: '8px',
84+
fontSize: '7px',
7585
display: 'flex',
7686
flexDirection: 'row',
7787
gap: '10px',
88+
fontWeight: 300,
7889
},
7990
});
8091

src/views/registerFonts.ts

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { Font } from '@react-pdf/renderer';
22

3-
import FontBold from '/assets/fonts/Inter-SemiBold.ttf';
3+
import FontItalic from '/assets/fonts/Inter-Italic.ttf';
4+
import FontExtraBold from '/assets/fonts/Inter-ExtraBold.ttf';
5+
import FontBold from '/assets/fonts/Inter-Bold.ttf';
6+
import FontSemiBold from '/assets/fonts/Inter-SemiBold.ttf';
47
import FontLight from '/assets/fonts/Inter-Light.ttf';
58
import FontMedium from '/assets/fonts/Inter-Medium.ttf';
69
import FontRegular from '/assets/fonts/Inter-Regular.ttf';
@@ -16,33 +19,43 @@ import NotoSansJPFontRegular from '/assets/fonts/NotoSansJP-Regular.ttf';
1619

1720
Font.register({
1821
family: 'Inter',
19-
format: 'truetype',
22+
2023
fonts: [
2124
{ src: FontLight, fontWeight: 300 },
2225
{ src: FontRegular, fontWeight: 400 },
26+
{ src: FontItalic, fontWeight: 400, fontStyle: 'italic' },
2327
{ src: FontMedium, fontWeight: 500 },
28+
{ src: FontSemiBold, fontWeight: 600 },
2429
{ src: FontBold, fontWeight: 700 },
30+
{ src: FontExtraBold, fontWeight: 800 },
2531
],
2632
});
2733

2834
Font.register({
2935
family: 'NotoSans',
30-
format: 'truetype',
31-
fonts: [{ src: NotoSansFontRegular }, { src: NotoSansFontBold }],
36+
37+
fonts: [
38+
{ src: NotoSansFontRegular, fontWeight: 400 },
39+
{ src: NotoSansFontBold, fontWeight: 700 },
40+
],
3241
});
3342

3443
Font.register({
3544
family: 'NotoSansSC',
36-
format: 'truetype',
37-
fonts: [{ src: NotoSansSCFontRegular }, { src: NotoSansSCFontBold }],
45+
46+
fonts: [
47+
{ src: NotoSansSCFontRegular, fontWeight: 400 },
48+
{ src: NotoSansSCFontBold, fontWeight: 700 },
49+
],
3850
});
3951

4052
Font.register({
4153
family: 'NotoSansJP',
42-
format: 'truetype',
43-
fonts: [{ src: NotoSansJPFontRegular }, { src: NotoSansJPFontBold }],
44-
});
4554

46-
Font.registerHyphenationCallback((word) => [word]);
55+
fonts: [
56+
{ src: NotoSansJPFontRegular, fontWeight: 400 },
57+
{ src: NotoSansJPFontBold, fontWeight: 700 },
58+
],
59+
});
4760

4861
export default () => {};

0 commit comments

Comments
 (0)