File tree Expand file tree Collapse file tree 6 files changed +27
-12
lines changed
Expand file tree Collapse file tree 6 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -35,18 +35,22 @@ public function generatePdf(Request $request){
3535 }
3636 $ filename = $ nameInfo ['filename ' ].'. ' .$ nameInfo ['extension ' ];
3737
38+ $ cssVariables = [
39+ '--titleMargin ' => $ request ->titleMargin .'px ' ,
40+ ];
3841 $ cssColors = [
3942 '--textColor ' => $ request ->textColor ,
4043 '--highlightColor ' => $ request ->highlightColor ,
4144 '--backgroundColor ' => $ request ->backgroundColor ,
4245 ];
4346 $ cssColors = $ colorService ->generateDarkerColors ($ cssColors , 2 );
47+ $ cssVariables = array_merge ($ cssVariables , $ cssColors );
4448
4549 $ htmlText = $ this ->markdownToHtml ($ rawText );
4650
4751 $ rawCss = Storage::disk ('public ' )->get ('app.css ' );
4852
49- $ parsedCss = $ this ->parseCssVariables ($ rawCss , $ cssColors );
53+ $ parsedCss = $ this ->parseCssVariables ($ rawCss , $ cssVariables );
5054
5155 $ css = '<style> ' . $ parsedCss .'</style> ' ;
5256
Original file line number Diff line number Diff line change 1010 --backgroundColor : # FFFFFF ;
1111 --backgroundColor0 : hsl (from var (--backgroundColor ) h s calc (l - 10 ));
1212 --backgroundColor1 : hsl (from var (--backgroundColor ) h s calc (l - 20 ));
13+
14+ --titleMargin : 8px ;
1315}
1416
1517# htmlText {
2527.parsedown h1 {
2628 font-size : 34px ;
2729 font-weight : bold;
28- margin-top : 20 px ;
30+ margin-top : var ( --titleMargin ) ;
2931}
3032
3133.parsedown h2 {
3234 font-size : 24px ;
3335 font-weight : bold;
34- margin-top : 20 px ;
36+ margin-top : var ( --titleMargin ) ;
3537}
3638
3739.parsedown h3 {
3840 font-size : 20px ;
3941 font-weight : bold;
40- margin-top : 20 px ;
42+ margin-top : var ( --titleMargin ) ;
4143}
4244
4345.parsedown h4 {
4446 font-size : 18px ;
4547 font-weight : bold;
46- margin-top : 20 px ;
48+ margin-top : var ( --titleMargin ) ;
4749}
4850
4951.parsedown h5 {
5052 font-size : 16px ;
5153 font-weight : bold;
52- margin-top : 20 px ;
54+ margin-top : var ( --titleMargin ) ;
5355}
5456
5557.parsedown ul {
Original file line number Diff line number Diff line change @@ -40,4 +40,9 @@ $(document).ready(function(){
4040 let newColor = $ ( this ) . val ( ) ;
4141 root . style . setProperty ( '--backgroundColor' , newColor ) ;
4242 } ) ;
43+
44+ $ ( '#titleMargin' ) . on ( 'change' , function ( ) {
45+ let newMargin = $ ( this ) . val ( ) ;
46+ root . style . setProperty ( '--titleMargin' , newMargin + 'px' ) ;
47+ } ) ;
4348} ) ;
Original file line number Diff line number Diff line change 11@props ([' disabled' => false ] )
22
3- <input @disabled ($disabled ) type =" color" {{ $attributes -> merge ([' class' => ' float-right rounded p-1 w-full h-10 cursor-pointer border border-gray-200 bg-white' ]) } } >
3+ <input @disabled ($disabled ) type =" color" {{ $attributes -> merge ([' class' => ' rounded p-1 w-full h-10 cursor-pointer border border-gray-200 bg-white shadow-sm ' ]) } } >
Original file line number Diff line number Diff line change 1414 <x-color-input-label for =" backgroundColor" class =" truncate" >Background Color</x-color-input-label >
1515 <x-color-input name =" backgroundColor" id =" backgroundColor" value =" #FFFFFF" ></x-color-input >
1616 </div >
17+ <div class =" flex flex-col flex-grow" >
18+ <x-input-label for =" titleMargin" class =" truncate" >Title Margin</x-input-label >
19+ <x-text-input name =" titleMargin" id =" titleMargin" placeholder =" 4px" type =" number" ></x-text-input >
20+ </div >
1721 </div >
1822</x-section >
Original file line number Diff line number Diff line change 99h1 {
1010 font-size : 34px ;
1111 font-weight : bold;
12- margin-top : 20 px ;
12+ margin-top : var ( --titleMargin ) ;
1313}
1414
1515h2 {
1616 font-size : 24px ;
1717 font-weight : bold;
18- margin-top : 20 px ;
18+ margin-top : var ( --titleMargin ) ;
1919}
2020
2121h3 {
2222 font-size : 20px ;
2323 font-weight : bold;
24- margin-top : 20 px ;
24+ margin-top : var ( --titleMargin ) ;
2525}
2626
2727h4 {
2828 font-size : 18px ;
2929 font-weight : bold;
30- margin-top : 20 px ;
30+ margin-top : var ( --titleMargin ) ;
3131}
3232
3333h5 {
3434 font-size : 16px ;
3535 font-weight : bold;
36- margin-top : 20 px ;
36+ margin-top : var ( --titleMargin ) ;
3737}
3838
3939ul {
You can’t perform that action at this time.
0 commit comments