File tree 4 files changed +72
-28
lines changed
4 files changed +72
-28
lines changed Original file line number Diff line number Diff line change 32
32
"pg" : " ^8.5.1" ,
33
33
"react" : " 17.0.1" ,
34
34
"react-dom" : " 17.0.1" ,
35
+ "react-textfit" : " ^1.1.1" ,
35
36
"short-uuid" : " ^4.1.0" ,
36
37
"sqlite3" : " ^5.0.0"
37
38
},
44
45
"@types/puppeteer" : " ^5.4.2" ,
45
46
"@types/react" : " ^17.0.0" ,
46
47
"@types/react-dom" : " ^17.0.0" ,
48
+ "@types/react-textfit" : " ^1.1.0" ,
47
49
"@types/sqlite3" : " ^3.1.6" ,
48
50
"@typescript-eslint/eslint-plugin" : " ^4.11.0" ,
49
51
"@typescript-eslint/parser" : " ^4.11.0" ,
Original file line number Diff line number Diff line change 1
1
import * as React from "react" ;
2
+ import { Textfit } from "react-textfit" ;
2
3
import { Card as CardModel } from "../model/card" ;
3
4
import styles from "../styles/card.module.css" ;
4
5
import {
@@ -187,25 +188,25 @@ const Card: React.FC<{ name: CardName; usedForCritter?: boolean }> = ({
187
188
return (
188
189
< >
189
190
< div className = { styles . card } >
190
- < div className = { styles . card_header_row } >
191
- < div className = { [ styles . circle , styles . card_header_symbol ] . join ( " " ) } >
191
+ < div className = { [ styles . card_header_row , colorClass ] . join ( " " ) } >
192
+ < div className = { [ styles . circle ] . join ( " " ) } >
192
193
< CardTypeSymbol cardType = { card . cardType } />
193
194
</ div >
194
- < div
195
- className = { [
196
- styles . circle ,
197
- styles . color_victory_point ,
198
- styles . card_header_vp ,
199
- ] . join ( " " ) }
200
- >
201
- < span className = { styles . card_header_vp_number } > { card . baseVP } </ span >
202
- </ div >
203
- < div className = { [ styles . card_header , colorClass ] . join ( " " ) } >
204
- < span > { name } </ span >
195
+ < div className = { styles . card_header } >
196
+ < span >
197
+ < Textfit min = { 1 } max = { 12 } mode = "single" >
198
+ { name }
199
+ </ Textfit >
200
+ </ span >
205
201
{ card . expansion && (
206
202
< span className = { styles . expansion } > { card . expansion } </ span >
207
203
) }
208
204
</ div >
205
+ < div
206
+ className = { [ styles . circle , styles . color_victory_point ] . join ( " " ) }
207
+ >
208
+ < span className = { styles . card_header_vp_number } > { card . baseVP } </ span >
209
+ </ div >
209
210
</ div >
210
211
< div className = { styles . rarity_label } >
211
212
{ rarityLabel }
Original file line number Diff line number Diff line change 1
1
.card {
2
2
min-height : 200px ;
3
- width : 240 px ;
3
+ width : 200 px ;
4
4
border-radius : 5px ;
5
5
position : relative;
6
6
border : 1px solid var (--border-color );
12
12
justify-content : space-between;
13
13
}
14
14
15
+ .card_header_row {
16
+ display : flex;
17
+ flex-wrap : nowrap;
18
+ justify-content : space-between;
19
+ width : 100% ;
20
+ overflow : hidden;
21
+ }
22
+
15
23
.card_header {
16
24
height : 35px ;
17
25
font-weight : var (--font-bold );
22
30
display : flex;
23
31
flex-direction : column;
24
32
justify-content : center;
33
+ flex : 1 1 auto;
34
+ overflow : hidden;
25
35
}
26
36
27
37
.expansion {
108
118
width : 24px ;
109
119
height : 24px ;
110
120
margin : 6px ;
111
-
112
121
text-align : center;
113
122
font-size : 27px ;
114
- }
115
-
116
- .card_header_vp {
117
- position : absolute;
118
- top : 0 ;
119
- right : 0 ;
120
- z-index : 10 ;
123
+ position : relative;
124
+ flex : 0 0 auto;
121
125
}
122
126
123
127
.card_header_vp_number {
127
131
margin-top : -14px ;
128
132
vertical-align : middle;
129
133
color : var (--color-vp-text );
130
- }
131
-
132
- .card_header_symbol {
133
- position : absolute;
134
- top : 0 ;
135
- z-index : 10 ;
134
+ flex : 0 0 auto;
136
135
}
137
136
138
137
.color_victory_point {
You can’t perform that action at this time.
0 commit comments