| 1 | import Svg, { Circle, Defs, G, LinearGradient, Path, Rect, Stop } from "react-native-svg"; |
| 2 | import { withUniwind } from "uniwind"; |
| 3 | |
| 4 | const ThemedSvg = withUniwind(Svg); |
| 5 | |
| 6 | /** Draws a host's glyph by its client definition's `icon` key; null for a key it has no art for. */ |
| 7 | export function SourceControlIcon(props: { |
| 8 | readonly kind: string; |
| 9 | readonly size?: number; |
| 10 | readonly color?: string; |
| 11 | readonly colorClassName?: string; |
| 12 | }) { |
| 13 | const size = props.size ?? 18; |
| 14 | |
| 15 | switch (props.kind) { |
| 16 | case "forgejo": |
| 17 | // Official two-color mark from https://forgejo.org/favicon.svg. |
| 18 | return ( |
| 19 | <Svg width={size} height={size} viewBox="0 0 212 212"> |
| 20 | <G transform="translate(6 6)" fill="none"> |
| 21 | <Path d="M58 168 v-98 a50 50 0 0 1 50-50 h20" stroke="#ff6600" strokeWidth={25} /> |
| 22 | <Path d="M58 168 v-30 a50 50 0 0 1 50-50 h20" stroke="#d40000" strokeWidth={25} /> |
| 23 | <Circle cx={142} cy={20} r={18} stroke="#ff6600" strokeWidth={15} /> |
| 24 | <Circle cx={142} cy={88} r={18} stroke="#d40000" strokeWidth={15} /> |
| 25 | <Circle cx={58} cy={180} r={18} stroke="#d40000" strokeWidth={15} /> |
| 26 | </G> |
| 27 | </Svg> |
| 28 | ); |
| 29 | case "github": |
| 30 | return ( |
| 31 | <ThemedSvg |
| 32 | width={size} |
| 33 | height={size} |
| 34 | viewBox="0 0 16 16" |
| 35 | color={props.color} |
| 36 | colorClassName={props.colorClassName} |
| 37 | fill="none" |
| 38 | > |
| 39 | <Path |
| 40 | fillRule="evenodd" |
| 41 | clipRule="evenodd" |
| 42 | 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" |
| 43 | fill="currentColor" |
| 44 | /> |
| 45 | </ThemedSvg> |
| 46 | ); |
| 47 | case "gitlab": |
| 48 | return ( |
| 49 | <Svg width={size} height={size} viewBox="0 0 32 32" fill="none"> |
| 50 | <Path |
| 51 | 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" |
| 52 | fill="#E24329" |
| 53 | /> |
| 54 | <Path |
| 55 | 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" |
| 56 | fill="#FC6D26" |
| 57 | /> |
| 58 | <Path |
| 59 | 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" |
| 60 | fill="#FCA326" |
| 61 | /> |
| 62 | <Path |
| 63 | 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" |
| 64 | fill="#FC6D26" |
| 65 | /> |
| 66 | </Svg> |
| 67 | ); |
| 68 | case "azure-devops": |
| 69 | // Microsoft Azure DevOps mark via selfhst/icons (CC BY 4.0): https://github.com/selfhst/icons/blob/main/svg/azure-devops.svg |
| 70 | return ( |
| 71 | <Svg width={size} height={size} viewBox="0 0 512 512"> |
| 72 | <Defs> |
| 73 | <LinearGradient |
| 74 | id="azure-a" |
| 75 | x1="58.027" |
| 76 | x2="58.027" |
| 77 | y1="356.668" |
| 78 | y2="100.668" |
| 79 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 80 | gradientUnits="userSpaceOnUse" |
| 81 | > |
| 82 | <Stop offset="0" stopColor="#163697" /> |
| 83 | <Stop offset=".276" stopColor="#2052cb" /> |
| 84 | <Stop offset=".518" stopColor="#2764e7" /> |
| 85 | <Stop offset=".879" stopColor="#367af2" /> |
| 86 | </LinearGradient> |
| 87 | <LinearGradient |
| 88 | id="azure-b" |
| 89 | x1="58.027" |
| 90 | x2="58.027" |
| 91 | y1="351.334" |
| 92 | y2="292.668" |
| 93 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 94 | gradientUnits="userSpaceOnUse" |
| 95 | > |
| 96 | <Stop offset="0" stopColor="#102784" /> |
| 97 | <Stop offset="1" stopColor="#2052cb" stopOpacity="0" /> |
| 98 | </LinearGradient> |
| 99 | <LinearGradient |
| 100 | id="azure-c" |
| 101 | x1="389.98" |
| 102 | x2="107.314" |
| 103 | y1="57.935" |
| 104 | y2="193.935" |
| 105 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 106 | gradientUnits="userSpaceOnUse" |
| 107 | > |
| 108 | <Stop offset="0" stopColor="#163697" /> |
| 109 | <Stop offset=".301" stopColor="#2052cb" /> |
| 110 | <Stop offset=".626" stopColor="#2764e7" /> |
| 111 | <Stop offset=".926" stopColor="#367af2" /> |
| 112 | </LinearGradient> |
| 113 | <LinearGradient |
| 114 | id="azure-d" |
| 115 | x1="391.996" |
| 116 | x2="341.385" |
| 117 | y1="76.552" |
| 118 | y2="78.224" |
| 119 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 120 | gradientUnits="userSpaceOnUse" |
| 121 | > |
| 122 | <Stop offset="0" stopColor="#102784" /> |
| 123 | <Stop offset="1" stopColor="#2052cb" stopOpacity="0" /> |
| 124 | </LinearGradient> |
| 125 | <LinearGradient |
| 126 | id="azure-e" |
| 127 | x1="442.24" |
| 128 | x2="442.24" |
| 129 | y1="54.769" |
| 130 | y2="419.38" |
| 131 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 132 | gradientUnits="userSpaceOnUse" |
| 133 | > |
| 134 | <Stop offset=".043" stopColor="#2052cb" /> |
| 135 | <Stop offset=".489" stopColor="#367af2" /> |
| 136 | <Stop offset=".943" stopColor="#16bbda" /> |
| 137 | </LinearGradient> |
| 138 | <LinearGradient |
| 139 | id="azure-f" |
| 140 | x1="435.596" |
| 141 | x2="425.732" |
| 142 | y1="270.413" |
| 143 | y2="385.266" |
| 144 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 145 | gradientUnits="userSpaceOnUse" |
| 146 | > |
| 147 | <Stop offset=".134" stopColor="#16bbda" stopOpacity="0" /> |
| 148 | <Stop offset=".932" stopColor="#6be7a0" stopOpacity=".8629" /> |
| 149 | </LinearGradient> |
| 150 | <LinearGradient |
| 151 | id="azure-g" |
| 152 | x1="437.081" |
| 153 | x2="507.893" |
| 154 | y1="204.362" |
| 155 | y2="119.081" |
| 156 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 157 | gradientUnits="userSpaceOnUse" |
| 158 | > |
| 159 | <Stop offset="0" stopColor="#2c68e0" stopOpacity="0" /> |
| 160 | <Stop offset=".898" stopColor="#66c0ff" stopOpacity=".5" /> |
| 161 | </LinearGradient> |
| 162 | <LinearGradient |
| 163 | id="azure-h" |
| 164 | x1="99.399" |
| 165 | x2="352.75" |
| 166 | y1="279.26" |
| 167 | y2="498.676" |
| 168 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 169 | gradientUnits="userSpaceOnUse" |
| 170 | > |
| 171 | <Stop offset=".005" stopColor="#367af2" /> |
| 172 | <Stop offset=".507" stopColor="#0fafff" /> |
| 173 | <Stop offset="1" stopColor="#26cfe8" /> |
| 174 | </LinearGradient> |
| 175 | <LinearGradient |
| 176 | id="azure-i" |
| 177 | x1="184.342" |
| 178 | x2="338.581" |
| 179 | y1="356.795" |
| 180 | y2="480.642" |
| 181 | gradientTransform="matrix(1 0 0 -1 0 514)" |
| 182 | gradientUnits="userSpaceOnUse" |
| 183 | > |
| 184 | <Stop offset=".443" stopColor="#26cfe8" stopOpacity="0" /> |
| 185 | <Stop offset=".897" stopColor="#6be7a0" stopOpacity=".8629" /> |
| 186 | </LinearGradient> |
| 187 | </Defs> |
| 188 | <Path |
| 189 | d="M116.1 73.4c-5.8 5.8-13.7 13.8-13.7 22.6v216.4c0 8.9-3.3 17.3-9 23.4s-13.3 9.2-21.1 8.5l-42.7-3.1c-7.9-.5-15-3.9-20.3-9.3-5.7-5.7-9.3-13.7-9.3-22.6V202.7c0-8.9 3.6-16.9 9.4-22.6l2-1.9z" |
| 190 | fill="url(#azure-a)" |
| 191 | /> |
| 192 | <Path |
| 193 | d="M116.1 73.4c-5.8 5.8-13.7 13.8-13.7 22.6v216.4c0 8.9-3.3 17.3-9 23.4s-13.3 9.2-21.1 8.5l-42.7-3.1c-7.9-.5-15-3.9-20.3-9.3-5.7-5.7-9.3-13.7-9.3-22.6V202.7c0-8.9 3.6-16.9 9.4-22.6l2-1.9z" |
| 194 | fill="url(#azure-b)" |
| 195 | /> |
| 196 | <Path |
| 197 | d="m500.5 366-128 106.7c-5.5 4.6-12.7 7.4-20.5 7.4q-2.4 0-4.8-.3l-112.5-16.9v27.8c0 11.7-9.6 21.3-21.3 21.3-7.3 0-13.5-3.6-17.5-9.1l-36.2-51.4-5.4-7.6-36.6-51.9-7-10c-2.6-3.5-3.9-7.8-3.9-12.3 0-6 2.5-11.6 6.8-15.7 3.8-3.7 9.1-5.8 14.5-5.8.4 0 1 .1 1.5.1l105.2 7.5L384 366.5l93.7 6.7c.7.1 1.6.1 2.3.1 7.8 0 14.9-2.7 20.5-7.3" |
| 198 | fill="url(#azure-c)" |
| 199 | /> |
| 200 | <Path |
| 201 | d="m500.5 366-128 106.7c-5.5 4.6-12.7 7.4-20.5 7.4q-2.4 0-4.8-.3l-112.5-16.9v27.8c0 11.7-9.6 21.3-21.3 21.3-7.3 0-13.5-3.6-17.5-9.1l-36.2-51.4-5.4-7.6-36.6-51.9-7-10c-2.6-3.5-3.9-7.8-3.9-12.3 0-6 2.5-11.6 6.8-15.7 3.8-3.7 9.1-5.8 14.5-5.8.4 0 1 .1 1.5.1l105.2 7.5L384 366.5l93.7 6.7c.7.1 1.6.1 2.3.1 7.8 0 14.9-2.7 20.5-7.3" |
| 202 | fill="url(#azure-d)" |
| 203 | /> |
| 204 | <Path |
| 205 | d="M512 170.7v170.7c0 9.9-4.5 18.8-11.5 24.6l-128 106.7c7-5.9 11.5-14.7 11.5-24.6V175.3c0-16.7 13-30.7 29.8-31.9l63.9-4.6c.7-.1 1.6-.1 2.3-.1 7.8 0 14.9 2.8 20.5 7.4 7 5.8 11.5 14.6 11.5 24.6" |
| 206 | fill="url(#azure-e)" |
| 207 | /> |
| 208 | <Path |
| 209 | d="M512 170.7v170.7c0 9.9-4.5 18.8-11.5 24.6l-128 106.7c7-5.9 11.5-14.7 11.5-24.6V175.3c0-16.7 13-30.7 29.8-31.9l63.9-4.6c.7-.1 1.6-.1 2.3-.1 7.8 0 14.9 2.8 20.5 7.4 7 5.8 11.5 14.6 11.5 24.6" |
| 210 | fill="url(#azure-f)" |
| 211 | fillOpacity=".7" |
| 212 | /> |
| 213 | <Path |
| 214 | d="M512 170.7v170.7c0 9.9-4.5 18.8-11.5 24.6l-128 106.7c7-5.9 11.5-14.7 11.5-24.6V175.3c0-16.7 13-30.7 29.8-31.9l63.9-4.6c.7-.1 1.6-.1 2.3-.1 7.8 0 14.9 2.8 20.5 7.4 7 5.8 11.5 14.6 11.5 24.6" |
| 215 | fill="url(#azure-g)" |
| 216 | /> |
| 217 | <Path |
| 218 | d="M384 125.5c0 11.2-8.6 20.5-19.8 21.3-.5 0-1.1.1-1.6.1l-127.9 9.2-132.3 9.1-72.7 5.5c-6.9.4-13.2 3.1-18.2 7.4L116.1 73.4c4.7-4.7 10.9-8 17.8-9.1l100.8-15.1V21.3C234.7 9.6 244.3 0 256 0c5.8 0 11.1 2.3 14.9 6.1l33.4 32.6 16.9 16.5 40.3 39.3 16.1 15.8c4.1 3.9 6.4 9.4 6.4 15.2" |
| 219 | fill="url(#azure-h)" |
| 220 | /> |
| 221 | <Path |
| 222 | d="M384 125.5c0 11.2-8.6 20.5-19.8 21.3-.5 0-1.1.1-1.6.1l-127.9 9.2-132.3 9.1-72.7 5.5c-6.9.4-13.2 3.1-18.2 7.4L116.1 73.4c4.7-4.7 10.9-8 17.8-9.1l100.8-15.1V21.3C234.7 9.6 244.3 0 256 0c5.8 0 11.1 2.3 14.9 6.1l33.4 32.6 16.9 16.5 40.3 39.3 16.1 15.8c4.1 3.9 6.4 9.4 6.4 15.2" |
| 223 | fill="url(#azure-i)" |
| 224 | fillOpacity=".5" |
| 225 | /> |
| 226 | </Svg> |
| 227 | ); |
| 228 | case "bitbucket": |
| 229 | return ( |
| 230 | <Svg width={size} height={size} viewBox="8.4 14.39 2481.29 2231.21"> |
| 231 | <Defs> |
| 232 | <LinearGradient |
| 233 | id="bitbucket-a" |
| 234 | x1="945.1094" |
| 235 | y1="1524.8389" |
| 236 | x2="944.4923" |
| 237 | y2="1524.1893" |
| 238 | gradientTransform="matrix(1996.6343 0 0 -1480.3047 -1884485.625 2258195)" |
| 239 | > |
| 240 | <Stop offset="0.18" stopColor="#0052CC" /> |
| 241 | <Stop offset="1" stopColor="#2684FF" /> |
| 242 | </LinearGradient> |
| 243 | </Defs> |
| 244 | <Path |
| 245 | fill="#2684FF" |
| 246 | 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" |
| 247 | /> |
| 248 | <Path |
| 249 | fill="url(#bitbucket-a)" |
| 250 | 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" |
| 251 | /> |
| 252 | </Svg> |
| 253 | ); |
| 254 | case "gitcafe": |
| 255 | // GitCafe's own mark from https://git.cafe/favicon.svg, inset like the web icon. |
| 256 | return ( |
| 257 | <Svg width={size} height={size} viewBox="0 0 64 64"> |
| 258 | <Rect x={4.8} y={4.8} width={54.4} height={54.4} fill="#a78bfa" /> |
| 259 | </Svg> |
| 260 | ); |
| 261 | default: |
| 262 | return null; |
| 263 | } |
| 264 | } |