mirror of
https://github.com/reiyua/github-profile-trophy-reiyua-mirror.git
synced 2026-11-17 06:02:09 +11:00
Support adaptive width (column=-1) (#130)
* Support adaptive width * Update readme * Fix typo error * Delete package-lock.json
This commit is contained in:
parent
94f9b41814
commit
e8b06776e1
2 changed files with 13 additions and 0 deletions
|
|
@ -168,6 +168,13 @@ https://github-profile-trophy.vercel.app/?username=ryo-ma&row=2&column=3
|
||||||
<img width="330" src="https://user-images.githubusercontent.com/6661165/91659474-c07f7400-eb0a-11ea-84f2-eb6b42547829.png">
|
<img width="330" src="https://user-images.githubusercontent.com/6661165/91659474-c07f7400-eb0a-11ea-84f2-eb6b42547829.png">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
Adaptive column
|
||||||
|
```
|
||||||
|
https://github-profile-trophy.vercel.app/?username=ryo-ma&column=-1
|
||||||
|
```
|
||||||
|
|
||||||
|
You can set `columns` to `-1` to adapt the width to the number of trophies, the parameter `row` will be ignored.
|
||||||
|
|
||||||
## Apply theme
|
## Apply theme
|
||||||
|
|
||||||
Available themes.
|
Available themes.
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,12 @@ export class Card {
|
||||||
|
|
||||||
trophyList.sortByRank();
|
trophyList.sortByRank();
|
||||||
|
|
||||||
|
if (this.maxColumn == -1) {
|
||||||
|
this.maxColumn = trophyList.length;
|
||||||
|
this.width = this.panelSize * this.maxColumn +
|
||||||
|
this.marginWidth * (this.maxColumn - 1);
|
||||||
|
}
|
||||||
|
|
||||||
const row = this.getRow(trophyList);
|
const row = this.getRow(trophyList);
|
||||||
this.height = this.getHeight(row);
|
this.height = this.getHeight(row);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue