File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -137,8 +137,39 @@ const renderRepoCard = (repo, options = {}) => {
137
137
gap : 25 ,
138
138
} ) . join ( "" ) ;
139
139
140
- // Calculate the card width and height based on the provided arguments or defaults
140
+ // Calculate the card width and height based on the provided arguments or defaults;
141
+
141
142
const width = card_width || 400 ;
143
+ const CARD_MIN_WIDTH = 287 ;
144
+ const CARD_DEFAULT_WIDTH = 287 ;
145
+ const RANK_CARD_MIN_WIDTH = 420 ;
146
+ const RANK_CARD_DEFAULT_WIDTH = 450 ;
147
+ const RANK_ONLY_CARD_MIN_WIDTH = 290 ;
148
+ const RANK_ONLY_CARD_DEFAULT_WIDTH = 290 ;
149
+ const minCardWidth =
150
+ ( hide_rank
151
+ ? clampValue (
152
+ 50 /* padding */ + calculateTextWidth ( ) * 2 ,
153
+ CARD_MIN_WIDTH ,
154
+ Infinity ,
155
+ )
156
+ : statItems . length
157
+ ? RANK_CARD_MIN_WIDTH
158
+ : RANK_ONLY_CARD_MIN_WIDTH ) + iconWidth ;
159
+ const defaultCardWidth =
160
+ ( hide_rank
161
+ ? CARD_DEFAULT_WIDTH
162
+ : statItems . length
163
+ ? RANK_CARD_DEFAULT_WIDTH
164
+ : RANK_ONLY_CARD_DEFAULT_WIDTH ) + iconWidth ;
165
+ let width = card_width
166
+ ? isNaN ( card_width )
167
+ ? defaultCardWidth
168
+ : card_width
169
+ : defaultCardWidth ;
170
+ if ( width < minCardWidth ) {
171
+ width = minCardWidth ;
172
+ }
142
173
143
174
const card = new Card ( {
144
175
defaultTitle : header . length > 35 ? `${ header . slice ( 0 , 35 ) } ...` : header ,
You can’t perform that action at this time.
0 commit comments