soccer-jersey-fork 1.0.91 → 1.0.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,8 +9,8 @@ export declare const drawStriped: (page: Svg, primaryColor: string, secondaryCol
9
9
  export declare const drawCheckered: (page: Svg, primaryColor: string, secondaryColor: string, size: "sm" | "lg", direction?: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
10
10
  export declare const drawDiamonds: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
11
11
  export declare const drawTwoColors: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
12
+ export declare const drawSleeveTwoColors: (page: Svg, primaryColor: string, secondaryColor: string, direction: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
12
13
  export declare const drawSleeveContrastingTwoColors: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
13
- export declare const drawSleeveTwoColors: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
14
14
  export declare const drawSingleBand: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
15
15
  export declare const drawSingleBandThin: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle?: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
16
16
  export declare const drawWaves: (page: Svg, primaryColor: string, secondaryColor: string, waveStyle: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
@@ -121,44 +121,54 @@ export const drawDiamonds = (page, primaryColor, secondaryColor) => {
121
121
  export const drawTwoColors = (page, primaryColor, secondaryColor, bandStyle) => {
122
122
  switch (bandStyle) {
123
123
  case "diagonalRight":
124
- return page.pattern(100, 100, function (add) {
124
+ return page.pattern(100, 100, (add) => {
125
125
  add.rect(90, 100).fill(primaryColor);
126
126
  add.rect(50, 120).fill(secondaryColor).move(50, 0).rotate(35);
127
127
  });
128
128
  case "diagonalLeft":
129
- return page.pattern(100, 100, function (add) {
129
+ return page.pattern(100, 100, (add) => {
130
130
  add.rect(90, 100).fill(primaryColor);
131
131
  add.rect(60, 140).fill(secondaryColor).move(52, -20).rotate(145);
132
132
  });
133
133
  case "horizontal":
134
- return page.pattern(100, 100, function (add) {
134
+ return page.pattern(100, 100, (add) => {
135
135
  add.rect(100, 100).fill(primaryColor);
136
136
  add.rect(100, 50).fill(secondaryColor).move(0, 52);
137
137
  });
138
138
  case "vertical":
139
- return page.pattern(90, 100, function (add) {
139
+ return page.pattern(90, 100, (add) => {
140
140
  add.rect(90, 100).fill(primaryColor);
141
141
  add.rect(50, 100).fill(secondaryColor).move(50, 0);
142
142
  });
143
143
  default:
144
- return page.pattern(90, 90, function (add) {
144
+ return page.pattern(90, 90, (add) => {
145
145
  add.rect(90, 100).fill(primaryColor);
146
146
  add.rect(20, 100).fill(secondaryColor).move(50, 0);
147
147
  });
148
148
  }
149
149
  };
150
+ export const drawSleeveTwoColors = (page, primaryColor, secondaryColor, direction) => {
151
+ switch (direction) {
152
+ case "horizontal": {
153
+ return page.pattern(100, 100, (add) => {
154
+ add.rect(100, 100).fill(primaryColor);
155
+ add.rect(100, 30).fill(secondaryColor);
156
+ });
157
+ }
158
+ default: {
159
+ return page.pattern(29, 100, (add) => {
160
+ add.rect(29, 100).fill(primaryColor);
161
+ add.rect(18, 100).fill(secondaryColor).move(-4, 0);
162
+ });
163
+ }
164
+ }
165
+ };
150
166
  export const drawSleeveContrastingTwoColors = (page, primaryColor, secondaryColor) => {
151
- return page.pattern(100, 100, function (add) {
167
+ return page.pattern(100, 100, (add) => {
152
168
  add.rect(100, 100).fill(primaryColor);
153
169
  add.rect(50, 100).fill(secondaryColor);
154
170
  });
155
171
  };
156
- export const drawSleeveTwoColors = (page, primaryColor, secondaryColor) => {
157
- return page.pattern(29, 100, (add) => {
158
- add.rect(29, 100).fill(primaryColor);
159
- add.rect(18, 100).fill(secondaryColor).move(-4, 0);
160
- });
161
- };
162
172
  export const drawSingleBand = (page, primaryColor, secondaryColor, bandStyle) => {
163
173
  switch (bandStyle) {
164
174
  case "diagonalRight":
@@ -208,7 +218,7 @@ export const drawSingleBandThin = (page, primaryColor, secondaryColor, bandStyle
208
218
  add.rect(100, 10).fill(secondaryColor).move(0, 35);
209
219
  });
210
220
  case "vertical":
211
- return drawVertical(48);
221
+ return drawVertical(45);
212
222
  default:
213
223
  return drawVertical(60);
214
224
  }
@@ -9,29 +9,24 @@ const meta = {
9
9
  export default meta;
10
10
  export const Default = {
11
11
  args: {
12
- shirtStyle: "singleBand",
12
+ shirtColor: "#d40410",
13
13
  sleeveColor: "#ffffff",
14
- sleeveCuffColor: "#E1001A",
15
- collarColor: "#E1001A",
16
- shirtColor: "#ffffff",
17
- shortsColor: "#ffffff",
18
- withBadge: false,
19
- texts: [
20
- { text: "10", x: 69, y: 130, size: 12, color: "#000000" },
21
- { text: "VfB", x: 52, y: 47, size: 16, color: "#ffffff" },
22
- ],
23
- images: [
24
- {
25
- src: "https://resources.simcups.com/flags/w80/1254.svg",
26
- x: 60,
27
- y: 20,
28
- width: 12,
29
- height: 12,
30
- },
31
- ],
32
- shirtStyleDirection: "horizontal",
33
- shirtStyleColor: "#E1001A",
14
+ shirtStyle: "striped",
15
+ shirtStyleColor: "#DA000C",
16
+ shirtBottomColor: "",
17
+ shirtStyleDirection: "vertical",
18
+ collarColor: "",
19
+ sleeveStyle: "twoColors",
20
+ sleeveStyleColor: "#DA000C",
21
+ sleeveStyleDirection: "horizontal",
22
+ sleeveCuffColor: "",
23
+ images: [],
24
+ texts: [],
25
+ shortsColor: "#DA000C",
26
+ shortsCuffColor: "",
27
+ shirtSideColor: "",
28
+ shortsSideColor: "#b3020c",
34
29
  shoulderSideColor: "",
35
- shortsSideColor: "#E1001A",
30
+ withBadge: true,
36
31
  },
37
32
  };
@@ -0,0 +1,2 @@
1
+ import { DrawSoccerJerseyProps } from "../types";
2
+ export declare const JerseyPage: (props: DrawSoccerJerseyProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import SoccerJersey from "../index";
3
+ export const JerseyPage = (props) => {
4
+ const jerseyImgSrc = SoccerJersey.draw(props);
5
+ return (_jsx("div", { style: { textAlign: "center" }, dangerouslySetInnerHTML: { __html: jerseyImgSrc } }));
6
+ };
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * This file has been modified from the original.
3
+ * Original source: https://github.com/nadchif/soccer-jersey/tree/master
4
+ * Modifications Copyright 2025 Lau Kai Chung
5
+ */
6
+ import type { Meta, StoryObj } from "@storybook/react-vite";
7
+ import { JerseyPage } from "./jersey-page";
8
+ declare const meta: Meta<typeof JerseyPage>;
9
+ export default meta;
10
+ type Story = StoryObj<typeof JerseyPage>;
11
+ export declare const Default: Story;
@@ -0,0 +1,32 @@
1
+ import { JerseyPage } from "./jersey-page";
2
+ const meta = {
3
+ title: "React Examples",
4
+ component: JerseyPage,
5
+ parameters: {
6
+ layout: "fullscreen",
7
+ },
8
+ };
9
+ export default meta;
10
+ export const Default = {
11
+ args: {
12
+ shirtColor: "#d40410",
13
+ sleeveColor: "#ffffff",
14
+ shirtStyle: "striped",
15
+ shirtStyleColor: "#DA000C",
16
+ shirtBottomColor: "",
17
+ shirtStyleDirection: "vertical",
18
+ collarColor: "",
19
+ sleeveStyle: "twoColors",
20
+ sleeveStyleColor: "#DA000C",
21
+ sleeveStyleDirection: "horizontal",
22
+ sleeveCuffColor: "",
23
+ images: [],
24
+ texts: [],
25
+ shortsColor: "#DA000C",
26
+ shortsCuffColor: "",
27
+ shirtSideColor: "",
28
+ shortsSideColor: "#b3020c",
29
+ shoulderSideColor: "",
30
+ withBadge: true,
31
+ },
32
+ };
@@ -206,7 +206,7 @@ function getPatternFill(page, baseColor, style, styleColor, type, direction = "v
206
206
  switch (style) {
207
207
  case "twoColors": {
208
208
  if (type === "sleeve") {
209
- return drawSleeveTwoColors(page, baseColor, styleColor);
209
+ return drawSleeveTwoColors(page, baseColor, styleColor, direction);
210
210
  }
211
211
  else {
212
212
  return drawTwoColors(page, baseColor, styleColor, direction);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soccer-jersey-fork",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "description": "Generate soccer jerseys in SVG format",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {