diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2019-01-15 10:48:40 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-01-22 20:21:02 +0100 |
commit | b1e8eaffc8569fcd1005a4a6f5d2768649c06c0c (patch) | |
tree | aee29ea54c3305514f13169aaa71411a5bbc1956 /server/sonar-docs/src/components/icons | |
parent | 33946649b9aabb705d4d3aaa90b0b23bbb5f032c (diff) | |
download | sonarqube-b1e8eaffc8569fcd1005a4a6f5d2768649c06c0c.tar.gz sonarqube-b1e8eaffc8569fcd1005a4a6f5d2768649c06c0c.zip |
Upgrade sonar-docs to gatsby v2 and Typescript
* Upgrade to gatsby v2
* Migrate to TS
* Add jest tests of some components
* Remove glamor
Diffstat (limited to 'server/sonar-docs/src/components/icons')
7 files changed, 266 insertions, 0 deletions
diff --git a/server/sonar-docs/src/components/icons/AlertWarnIcon.tsx b/server/sonar-docs/src/components/icons/AlertWarnIcon.tsx new file mode 100644 index 00000000000..47ed1a9f326 --- /dev/null +++ b/server/sonar-docs/src/components/icons/AlertWarnIcon.tsx @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import Icon, { IconProps } from './Icon'; + +export default function AlertWarnIcon({ className, fill = '#ed7d20', size }: IconProps) { + return ( + <Icon className={className} size={size}> + <path + d="M8 1.143q1.866 0 3.442.92t2.496 2.496.92 3.442-.92 3.442-2.496 2.496-3.442.92-3.442-.92-2.496-2.496-.92-3.442.92-3.442 2.496-2.496T8 1.143zm1.143 11.134v-1.696q0-.125-.08-.21t-.196-.085H7.153q-.116 0-.205.089t-.089.205v1.696q0 .116.089.205t.205.089h1.714q.116 0 .196-.085t.08-.21zm-.018-3.072l.161-5.545q0-.107-.089-.161-.089-.071-.214-.071H7.019q-.125 0-.214.071-.089.054-.089.161l.152 5.545q0 .089.089.156t.214.067h1.652q.125 0 .21-.067t.094-.156z" + style={{ fill }} + /> + </Icon> + ); +} diff --git a/server/sonar-docs/src/components/icons/ChevronDownIcon.tsx b/server/sonar-docs/src/components/icons/ChevronDownIcon.tsx new file mode 100644 index 00000000000..d8d13b3cc7d --- /dev/null +++ b/server/sonar-docs/src/components/icons/ChevronDownIcon.tsx @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import Icon, { IconProps } from './Icon'; + +export default function ChevronDownIcon({ className, fill = 'currentColor', size }: IconProps) { + return ( + <Icon className={className} size={size}> + <path + d="M3.2,5.6c0-0.1,0-0.2,0.1-0.3c0.2-0.2,0.5-0.2,0.6,0l4.1,4.1l4.1-4.1c0.2-0.2,0.5-0.2,0.6,0 c0.2,0.2,0.2,0.5,0,0.6c0,0,0,0,0,0l0,0l-4.5,4.5c-0.2,0.2-0.5,0.2-0.6,0l0,0L3.3,5.9C3.2,5.9,3.2,5.7,3.2,5.6z" + style={{ fill }} + /> + </Icon> + ); +} diff --git a/server/sonar-docs/src/components/icons/ChevronUpIcon.tsx b/server/sonar-docs/src/components/icons/ChevronUpIcon.tsx new file mode 100644 index 00000000000..0ada103dd89 --- /dev/null +++ b/server/sonar-docs/src/components/icons/ChevronUpIcon.tsx @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import Icon, { IconProps } from './Icon'; + +export default function ChevronUpIcon({ className, fill = 'currentColor', size }: IconProps) { + return ( + <Icon className={className} size={size}> + <path + d="M13,10c0,0.1,0,0.2-0.1,0.3c-0.2,0.2-0.5,0.2-0.6,0L8.1,6.2L4,10.3c-0.2,0.2-0.5,0.2-0.6,0 c-0.2-0.2-0.2-0.5,0-0.6c0,0,0,0,0,0l0,0l4.5-4.5c0.2-0.2,0.5-0.2,0.6,0l0,0l4.4,4.4C13,9.7,13,9.8,13,10z" + style={{ fill }} + /> + </Icon> + ); +} diff --git a/server/sonar-docs/src/components/icons/ClearIcon.tsx b/server/sonar-docs/src/components/icons/ClearIcon.tsx new file mode 100644 index 00000000000..bae6b7c1a73 --- /dev/null +++ b/server/sonar-docs/src/components/icons/ClearIcon.tsx @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import Icon, { IconProps } from './Icon'; + +export default function ClearIcon({ className, fill = 'currentColor', size }: IconProps) { + return ( + <Icon className={className} size={size} viewBox="0 0 48 48"> + <path + d="M28.24 24L47.07 5.16A3 3 0 1 0 42.93.83l-.09.1L24 19.76 5.16.93A3 3 0 0 0 .93 5.16L19.76 24 .93 42.84a3 3 0 1 0 4.14 4.33l.09-.1L24 28.24l18.84 18.83a3 3 0 1 0 4.33-4.14l-.1-.09z" + style={{ fill }} + /> + </Icon> + ); +} diff --git a/server/sonar-docs/src/components/icons/DetachIcon.tsx b/server/sonar-docs/src/components/icons/DetachIcon.tsx new file mode 100644 index 00000000000..d65dee0afa4 --- /dev/null +++ b/server/sonar-docs/src/components/icons/DetachIcon.tsx @@ -0,0 +1,32 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import Icon, { IconProps } from './Icon'; + +export default function DetachIcon({ className, fill = 'currentColor', size }: IconProps) { + return ( + <Icon className={className} size={size}> + <path + d="M12 9.25v2.5A2.25 2.25 0 0 1 9.75 14h-6.5A2.25 2.25 0 0 1 1 11.75v-6.5A2.25 2.25 0 0 1 3.25 3h5.5c.14 0 .25.11.25.25v.5c0 .14-.11.25-.25.25h-5.5C2.562 4 2 4.563 2 5.25v6.5c0 .688.563 1.25 1.25 1.25h6.5c.688 0 1.25-.563 1.25-1.25v-2.5c0-.14.11-.25.25-.25h.5c.14 0 .25.11.25.25zm3-6.75v4c0 .273-.227.5-.5.5a.497.497 0 0 1-.352-.148l-1.375-1.375L7.68 10.57a.27.27 0 0 1-.18.078.27.27 0 0 1-.18-.078l-.89-.89a.27.27 0 0 1-.078-.18.27.27 0 0 1 .078-.18l5.093-5.093-1.375-1.375A.497.497 0 0 1 10 2.5c0-.273.227-.5.5-.5h4c.273 0 .5.227.5.5z" + style={{ fill }} + /> + </Icon> + ); +} diff --git a/server/sonar-docs/src/components/icons/DownloadIcon.tsx b/server/sonar-docs/src/components/icons/DownloadIcon.tsx new file mode 100644 index 00000000000..4958ceda64d --- /dev/null +++ b/server/sonar-docs/src/components/icons/DownloadIcon.tsx @@ -0,0 +1,36 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import Icon, { IconProps } from './Icon'; + +export default function DownloadIcon({ className, fill = 'currentColor', size }: IconProps) { + return ( + <Icon className={className} size={size} viewBox="0 0 48 48"> + <path + d="M45.68 22.86a1.31 1.31 0 0 0-1.32 1.32v12a5.91 5.91 0 0 1-5.9 5.91H9.54a5.91 5.91 0 0 1-5.9-5.91V24A1.32 1.32 0 0 0 1 24v12.16a8.56 8.56 0 0 0 8.54 8.55h28.92A8.56 8.56 0 0 0 47 36.16v-12a1.32 1.32 0 0 0-1.32-1.3z" + style={{ fill }} + /> + <path + d="M23.07 34.24a1.36 1.36 0 0 0 .93.39 1.32 1.32 0 0 0 .93-.39l8.37-8.38A1.32 1.32 0 0 0 31.44 24l-6.12 6.13V3.39a1.32 1.32 0 0 0-2.64 0v26.74L16.55 24a1.32 1.32 0 0 0-1.86 1.86z" + style={{ fill }} + /> + </Icon> + ); +} diff --git a/server/sonar-docs/src/components/icons/Icon.tsx b/server/sonar-docs/src/components/icons/Icon.tsx new file mode 100644 index 00000000000..389e0cb0a8b --- /dev/null +++ b/server/sonar-docs/src/components/icons/Icon.tsx @@ -0,0 +1,70 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; + +export interface IconProps { + className?: string; + fill?: string; + size?: number; +} + +interface Props { + children: React.ReactNode; + className?: string; + size?: number; + style?: React.CSSProperties; + + // try to avoid using these: + width?: number; + height?: number; + viewBox?: string; +} + +export default function Icon({ + children, + className, + size = 16, + style, + height = size, + width = size, + viewBox = '0 0 16 16', + ...other +}: Props) { + return ( + <svg + className={className} + height={height} + style={{ + fillRule: 'evenodd', + clipRule: 'evenodd', + strokeLinejoin: 'round', + strokeMiterlimit: 1.41421, + ...style + }} + version="1.1" + viewBox={viewBox} + width={width} + xmlSpace="preserve" + xmlnsXlink="http://www.w3.org/1999/xlink" + {...other}> + {children} + </svg> + ); +} |