1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Font Size Test</ title >
7+ < style >
8+ body {
9+ font-family : -apple-system, BlinkMacSystemFont, 'Segoe UI' , Roboto, sans-serif;
10+ padding : 20px ;
11+ line-height : 1.5 ;
12+ }
13+ .test-area {
14+ border : 1px solid # ccc ;
15+ padding : 15px ;
16+ margin : 10px 0 ;
17+ background : # f9f9f9 ;
18+ }
19+ .font-size-controls {
20+ margin-bottom : 20px ;
21+ }
22+ button {
23+ margin : 5px ;
24+ padding : 8px 16px ;
25+ cursor : pointer;
26+ }
27+ button .active {
28+ background-color : # 007bff ;
29+ color : white;
30+ }
31+ # current-size {
32+ font-weight : bold;
33+ margin-top : 10px ;
34+ color : # 007bff ;
35+ }
36+ .sample-text {
37+ margin : 10px 0 ;
38+ padding : 10px ;
39+ background : white;
40+ border : 1px solid # ddd ;
41+ }
42+ </ style >
43+ </ head >
44+ < body >
45+ < h1 > Font Size Test</ h1 >
46+
47+ < div class ="font-size-controls ">
48+ < button onclick ="applyFontSize('small') "> Small</ button >
49+ < button onclick ="applyFontSize('medium') " class ="active "> Medium</ button >
50+ < button onclick ="applyFontSize('large') "> Large</ button >
51+ < button onclick ="applyFontSize('xlarge') "> Extra Large</ button >
52+ </ div >
53+
54+ < div id ="current-size "> Current size: medium</ div >
55+
56+ < div class ="test-area ">
57+ < div class ="sample-text ">
58+ < h2 > Sample Text H2</ h2 >
59+ < p > This is a sample paragraph with some text to test the font sizing.</ p >
60+ < ul >
61+ < li > List item 1</ li >
62+ < li > List item 2</ li >
63+ < li > List item 3</ li >
64+ </ ul >
65+ < small > This is small text</ small >
66+ < strong > This is bold text</ strong >
67+ </ div >
68+ </ div >
69+
70+ < script type ="module ">
71+ // Import the applyFontSize function from utils
72+ import { applyFontSize } from './shared/utils.js' ;
73+
74+ document . querySelectorAll ( '.font-size-controls button' ) . forEach ( button => {
75+ button . addEventListener ( 'click' , ( e ) => {
76+ // Remove active class from all buttons
77+ document . querySelectorAll ( '.font-size-controls button' ) . forEach ( b => b . classList . remove ( 'active' ) ) ;
78+ // Add active class to clicked button
79+ button . classList . add ( 'active' ) ;
80+
81+ const fontSize = button . textContent . toLowerCase ( ) ;
82+ applyFontSize ( fontSize ) ;
83+ document . getElementById ( 'current-size' ) . textContent = `Current size: ${ fontSize } ` ;
84+ } ) ;
85+ } ) ;
86+
87+ // Show the current font size on load
88+ document . getElementById ( 'current-size' ) . textContent = 'Current size: medium' ;
89+ </ script >
90+ </ body >
91+ </ html >
0 commit comments