From b1e8eaffc8569fcd1005a4a6f5d2768649c06c0c Mon Sep 17 00:00:00 2001 From: Grégoire Aubert Date: Tue, 15 Jan 2019 10:48:40 +0100 Subject: Upgrade sonar-docs to gatsby v2 and Typescript * Upgrade to gatsby v2 * Migrate to TS * Add jest tests of some components * Remove glamor --- .../src/components/icons/AlertWarnIcon.tsx | 32 ++++++++++ .../src/components/icons/ChevronDownIcon.tsx | 32 ++++++++++ .../src/components/icons/ChevronUpIcon.tsx | 32 ++++++++++ .../sonar-docs/src/components/icons/ClearIcon.tsx | 32 ++++++++++ .../sonar-docs/src/components/icons/DetachIcon.tsx | 32 ++++++++++ .../src/components/icons/DownloadIcon.tsx | 36 +++++++++++ server/sonar-docs/src/components/icons/Icon.tsx | 70 ++++++++++++++++++++++ 7 files changed, 266 insertions(+) create mode 100644 server/sonar-docs/src/components/icons/AlertWarnIcon.tsx create mode 100644 server/sonar-docs/src/components/icons/ChevronDownIcon.tsx create mode 100644 server/sonar-docs/src/components/icons/ChevronUpIcon.tsx create mode 100644 server/sonar-docs/src/components/icons/ClearIcon.tsx create mode 100644 server/sonar-docs/src/components/icons/DetachIcon.tsx create mode 100644 server/sonar-docs/src/components/icons/DownloadIcon.tsx create mode 100644 server/sonar-docs/src/components/icons/Icon.tsx (limited to 'server/sonar-docs/src/components/icons') 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 ( + + + + ); +} 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 ( + + + + ); +} 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 ( + + + + ); +} 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 ( + + + + ); +} 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 ( + + + + ); +} 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 ( + + + + + ); +} 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 ( + + {children} + + ); +} -- cgit v1.2.3