Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

SourceControlIcon.tsx

130 lines5.6 KB

1import Svg, { Circle, Defs, G, LinearGradient, Path, Stop } from "react-native-svg";
2import { withUniwind } from "uniwind";
3​
4const ThemedSvg = withUniwind(Svg);
5​
6export type SourceControlIconKind =
7 | "github"
8 | "github-enterprise"
9 | "gitlab"
10 | "forgejo"
11 | "bitbucket"
12 | "azure-devops";
13​
14export function SourceControlIcon(props: {
15 readonly kind: SourceControlIconKind;
16 readonly size?: number;
17 readonly color?: string;
18 readonly colorClassName?: string;
19}) {
20 const size = props.size ?? 18;
21​
22 switch (props.kind) {
23 case "forgejo":
24 // Official two-color mark from https://forgejo.org/favicon.svg.
25 return (
26 <Svg width={size} height={size} viewBox="0 0 212 212">
27 <G transform="translate(6 6)" fill="none">
28 <Path d="M58 168 v-98 a50 50 0 0 1 50-50 h20" stroke="#ff6600" strokeWidth={25} />
29 <Path d="M58 168 v-30 a50 50 0 0 1 50-50 h20" stroke="#d40000" strokeWidth={25} />
30 <Circle cx={142} cy={20} r={18} stroke="#ff6600" strokeWidth={15} />
31 <Circle cx={142} cy={88} r={18} stroke="#d40000" strokeWidth={15} />
32 <Circle cx={58} cy={180} r={18} stroke="#d40000" strokeWidth={15} />
33 </G>
34 </Svg>
35 );
36 case "github":
37 case "github-enterprise":
38 return (
39 <ThemedSvg
40 width={size}
41 height={size}
42 viewBox="0 0 16 16"
43 color={props.color}
44 colorClassName={props.colorClassName}
45 fill="none"
46 >
47 <Path
48 fillRule="evenodd"
49 clipRule="evenodd"
50 d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82A7.68 7.68 0 0 1 8.02 3.86c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"
51 fill="currentColor"
52 />
53 </ThemedSvg>
54 );
55 case "gitlab":
56 return (
57 <Svg width={size} height={size} viewBox="0 0 32 32" fill="none">
58 <Path
59 d="m31.46 12.78-.04-.12-4.35-11.35A1.14 1.14 0 0 0 25.94.6c-.24 0-.47.1-.66.24-.19.15-.33.36-.39.6l-2.94 9h-11.9l-2.94-9A1.14 1.14 0 0 0 6.07.58a1.15 1.15 0 0 0-1.14.72L.58 12.68l-.05.11a8.1 8.1 0 0 0 2.68 9.34l.02.01.04.03 6.63 4.97 3.28 2.48 2 1.52a1.35 1.35 0 0 0 1.62 0l2-1.52 3.28-2.48 6.67-5h.02a8.09 8.09 0 0 0 2.7-9.36Z"
60 fill="#E24329"
61 />
62 <Path
63 d="m31.46 12.78-.04-.12a14.75 14.75 0 0 0-5.86 2.64l-9.55 7.24 6.09 4.6 6.67-5h.02a8.09 8.09 0 0 0 2.67-9.36Z"
64 fill="#FC6D26"
65 />
66 <Path
67 d="m9.9 27.14 3.28 2.48 2 1.52a1.35 1.35 0 0 0 1.62 0l2-1.52 3.28-2.48-6.1-4.6-6.07 4.6Z"
68 fill="#FCA326"
69 />
70 <Path
71 d="M6.44 15.3a14.71 14.71 0 0 0-5.86-2.63l-.05.12a8.1 8.1 0 0 0 2.68 9.34l.02.01.04.03 6.63 4.97 6.1-4.6-9.56-7.24Z"
72 fill="#FC6D26"
73 />
74 </Svg>
75 );
76 case "azure-devops":
77 return (
78 <Svg width={size} height={size} viewBox="0 0 96 96">
79 <Defs>
80 <LinearGradient id="azure-a" x1="42.83" x2="15.79" y1="12.69" y2="92.57">
81 <Stop offset="0" stopColor="#114A8B" />
82 <Stop offset="1" stopColor="#0669BC" />
83 </LinearGradient>
84 <LinearGradient id="azure-b" x1="47.84" x2="77.52" y1="10.36" y2="89.44">
85 <Stop offset="0" stopColor="#3CCBF4" />
86 <Stop offset="1" stopColor="#2892DF" />
87 </LinearGradient>
88 </Defs>
89 <Path
90 fill="url(#azure-a)"
91 d="M33.34 6.54h26.04l-27.03 80.1a4.15 4.15 0 0 1-3.94 2.81H8.15a4.14 4.14 0 0 1-3.93-5.47L29.4 9.38a4.15 4.15 0 0 1 3.94-2.83z"
92 />
93 <Path
94 fill="#0078D4"
95 d="M71.17 60.26H29.88a1.91 1.91 0 0 0-1.3 3.31l26.53 24.76a4.17 4.17 0 0 0 2.85 1.13h23.38z"
96 />
97 <Path
98 fill="url(#azure-b)"
99 d="M66.6 9.36a4.14 4.14 0 0 0-3.93-2.82H33.65a4.15 4.15 0 0 1 3.93 2.82l25.18 74.62a4.15 4.15 0 0 1-3.93 5.48h29.02a4.15 4.15 0 0 0 3.93-5.48z"
100 />
101 </Svg>
102 );
103 case "bitbucket":
104 return (
105 <Svg width={size} height={size} viewBox="8.4 14.39 2481.29 2231.21">
106 <Defs>
107 <LinearGradient
108 id="bitbucket-a"
109 x1="945.1094"
110 y1="1524.8389"
111 x2="944.4923"
112 y2="1524.1893"
113 gradientTransform="matrix(1996.6343 0 0 -1480.3047 -1884485.625 2258195)"
114 >
115 <Stop offset="0.18" stopColor="#0052CC" />
116 <Stop offset="1" stopColor="#2684FF" />
117 </LinearGradient>
118 </Defs>
119 <Path
120 fill="#2684FF"
121 d="M88.92,14.4C45.02,13.83,8.97,48.96,8.41,92.86c-0.06,4.61,0.28,9.22,1.02,13.77l337.48,2048.72 c8.68,51.75,53.26,89.8,105.74,90.24h1619.03c39.38,0.5,73.19-27.9,79.49-66.78l337.49-2071.78c7.03-43.34-22.41-84.17-65.75-91.2 c-4.55-0.74-9.15-1.08-13.76-1.02L88.92,14.4z M1509.99,1495.09H993.24l-139.92-731h781.89L1509.99,1495.09z"
122 />
123 <Path
124 fill="url(#bitbucket-a)"
125 d="M2379.27,763.06h-745.5l-125.12,730.42H992.31l-609.67,723.67c19.32,16.71,43.96,26,69.5,26.21h1618.13 c39.35,0.51,73.14-27.88,79.44-66.72L2379.27,763.06z"
126 />
127 </Svg>
128 );
129 }