浏览代码

SONAR-22049 Align buttons components

pull/3361/head
stanislavh 1 个月前
父节点
当前提交
21e048436d
共有 35 个文件被更改,包括 96 次插入49 次删除
  1. 1
    0
      server/sonar-web/design-system/jest.config.js
  2. 1
    1
      server/sonar-web/design-system/src/components/Accordion.tsx
  3. 1
    1
      server/sonar-web/design-system/src/components/BorderlessAccordion.tsx
  4. 1
    1
      server/sonar-web/design-system/src/components/BubbleChart.tsx
  5. 1
    1
      server/sonar-web/design-system/src/components/ExecutionFlowAccordion.tsx
  6. 1
    1
      server/sonar-web/design-system/src/components/FacetBox.tsx
  7. 1
    1
      server/sonar-web/design-system/src/components/FacetItem.tsx
  8. 1
    1
      server/sonar-web/design-system/src/components/FailedQGConditionLink.tsx
  9. 1
    1
      server/sonar-web/design-system/src/components/IlllustredSelectionCard.tsx
  10. 2
    1
      server/sonar-web/design-system/src/components/SpotlightTour.tsx
  11. 1
    1
      server/sonar-web/design-system/src/components/Tabs.tsx
  12. 1
    1
      server/sonar-web/design-system/src/components/TextAccordion.tsx
  13. 1
    1
      server/sonar-web/design-system/src/components/ToggleButton.tsx
  14. 1
    1
      server/sonar-web/design-system/src/components/__tests__/Dropdown-test.tsx
  15. 1
    9
      server/sonar-web/design-system/src/components/buttons/BareButtons.tsx
  16. 1
    1
      server/sonar-web/design-system/src/components/buttons/ButtonLink.tsx
  17. 1
    2
      server/sonar-web/design-system/src/components/buttons/DownloadButton.tsx
  18. 1
    1
      server/sonar-web/design-system/src/components/buttons/WrapperButton.tsx
  19. 0
    6
      server/sonar-web/design-system/src/components/buttons/index.ts
  20. 1
    1
      server/sonar-web/design-system/src/components/clipboard.tsx
  21. 1
    1
      server/sonar-web/design-system/src/components/code-line/LineFinding.tsx
  22. 1
    1
      server/sonar-web/design-system/src/components/input/FileInput.tsx
  23. 2
    1
      server/sonar-web/design-system/src/components/input/InputMultiSelect.tsx
  24. 1
    1
      server/sonar-web/design-system/src/components/modal/Modal.tsx
  25. 1
    1
      server/sonar-web/design-system/src/components/subnavigation/SubnavigationAccordion.tsx
  26. 30
    0
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/BareButton.tsx
  27. 5
    4
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/Button.tsx
  28. 2
    2
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/ButtonPrimary.tsx
  29. 1
    1
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/ButtonSecondary.tsx
  30. 1
    1
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/DangerButtonPrimary.tsx
  31. 1
    1
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/DangerButtonSecondary.tsx
  32. 2
    2
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/ThirdPartyButton.tsx
  33. 0
    0
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/__tests__/ButtonPrimary-test.tsx
  34. 27
    0
      server/sonar-web/design-system/src/sonar-aligned/components/buttons/index.ts
  35. 1
    0
      server/sonar-web/design-system/src/sonar-aligned/components/index.ts

+ 1
- 0
server/sonar-web/design-system/jest.config.js 查看文件

'src/components/**/*.{ts,tsx,js}', 'src/components/**/*.{ts,tsx,js}',
'src/helpers/**/*.{ts,tsx,js}', 'src/helpers/**/*.{ts,tsx,js}',
'src/hooks/**/*.{ts,tsx,js}', 'src/hooks/**/*.{ts,tsx,js}',
'src/sonar-aligned/**/*.{ts,tsx,js}',
'!src/helpers/{keycodes,testUtils}.{ts,tsx}', '!src/helpers/{keycodes,testUtils}.{ts,tsx}',
], ],
coverageReporters: ['lcovonly', 'text'], coverageReporters: ['lcovonly', 'text'],

+ 1
- 1
server/sonar-web/design-system/src/components/Accordion.tsx 查看文件

import React from 'react'; import React from 'react';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeBorder, themeColor, themeContrast } from '../helpers'; import { themeBorder, themeColor, themeContrast } from '../helpers';
import { BareButton } from '../sonar-aligned/components/buttons';
import { ThemedProps } from '../types'; import { ThemedProps } from '../types';
import { BareButton } from './buttons';
import { OpenCloseIndicator } from './icons/OpenCloseIndicator'; import { OpenCloseIndicator } from './icons/OpenCloseIndicator';


interface AccordionProps { interface AccordionProps {

+ 1
- 1
server/sonar-web/design-system/src/components/BorderlessAccordion.tsx 查看文件

import classNames from 'classnames'; import classNames from 'classnames';
import { uniqueId } from 'lodash'; import { uniqueId } from 'lodash';
import * as React from 'react'; import * as React from 'react';
import { BareButton } from './buttons';
import { BareButton } from '../sonar-aligned/components/buttons';
import { OpenCloseIndicator } from './icons/OpenCloseIndicator'; import { OpenCloseIndicator } from './icons/OpenCloseIndicator';


interface AccordionProps { interface AccordionProps {

+ 1
- 1
server/sonar-web/design-system/src/components/BubbleChart.tsx 查看文件

import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer'; import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeColor, themeContrast } from '../helpers'; import { themeColor, themeContrast } from '../helpers';
import { ButtonSecondary } from '../sonar-aligned/components/buttons';
import { BubbleColorVal } from '../types/charts'; import { BubbleColorVal } from '../types/charts';
import { Note } from './Text'; import { Note } from './Text';
import { Tooltip } from './Tooltip'; import { Tooltip } from './Tooltip';
import { ButtonSecondary } from './buttons';


const TICKS_COUNT = 5; const TICKS_COUNT = 5;



+ 1
- 1
server/sonar-web/design-system/src/components/ExecutionFlowAccordion.tsx 查看文件

import { ReactNode } from 'react'; import { ReactNode } from 'react';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeBorder, themeColor, themeContrast } from '../helpers/theme'; import { themeBorder, themeColor, themeContrast } from '../helpers/theme';
import { BareButton } from './buttons';
import { BareButton } from '../sonar-aligned/components/buttons';
import { OpenCloseIndicator } from './icons/OpenCloseIndicator'; import { OpenCloseIndicator } from './icons/OpenCloseIndicator';


interface Props { interface Props {

+ 1
- 1
server/sonar-web/design-system/src/components/FacetBox.tsx 查看文件

import * as React from 'react'; import * as React from 'react';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeColor } from '../helpers'; import { themeColor } from '../helpers';
import { BareButton } from '../sonar-aligned/components/buttons';
import { Badge } from './Badge'; import { Badge } from './Badge';
import { DestructiveIcon } from './InteractiveIcon'; import { DestructiveIcon } from './InteractiveIcon';
import { Spinner } from './Spinner'; import { Spinner } from './Spinner';
import { Tooltip as SCTooltip } from './Tooltip'; import { Tooltip as SCTooltip } from './Tooltip';
import { BareButton } from './buttons';
import { OpenCloseIndicator } from './icons'; import { OpenCloseIndicator } from './icons';
import { CloseIcon } from './icons/CloseIcon'; import { CloseIcon } from './icons/CloseIcon';



+ 1
- 1
server/sonar-web/design-system/src/components/FacetItem.tsx 查看文件

import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeBorder, themeColor, themeContrast } from '../helpers'; import { themeBorder, themeColor, themeContrast } from '../helpers';
import { isDefined } from '../helpers/types'; import { isDefined } from '../helpers/types';
import { ButtonProps, ButtonSecondary } from './buttons';
import { ButtonProps, ButtonSecondary } from '../sonar-aligned/components/buttons';


export type FacetItemProps = Omit<ButtonProps, 'name' | 'onClick'> & { export type FacetItemProps = Omit<ButtonProps, 'name' | 'onClick'> & {
active?: boolean; active?: boolean;

+ 1
- 1
server/sonar-web/design-system/src/components/FailedQGConditionLink.tsx 查看文件

import styled from '@emotion/styled'; import styled from '@emotion/styled';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeColor } from '../helpers/theme'; import { themeColor } from '../helpers/theme';
import { ButtonProps, DangerButtonSecondary } from './buttons';
import { ButtonProps, DangerButtonSecondary } from '../sonar-aligned/components/buttons';
import { ChevronRightIcon } from './icons/ChevronRightIcon'; import { ChevronRightIcon } from './icons/ChevronRightIcon';


const StyledFailedQGConditionLink = styled(DangerButtonSecondary)` const StyledFailedQGConditionLink = styled(DangerButtonSecondary)`

+ 1
- 1
server/sonar-web/design-system/src/components/IlllustredSelectionCard.tsx 查看文件

import { ReactNode } from 'react'; import { ReactNode } from 'react';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeBorder, themeColor } from '../helpers/theme'; import { themeBorder, themeColor } from '../helpers/theme';
import { BareButton } from './buttons';
import { BareButton } from '../sonar-aligned/components/buttons';


interface Props { interface Props {
className?: string; className?: string;

+ 2
- 1
server/sonar-web/design-system/src/components/SpotlightTour.tsx 查看文件

import tw from 'twin.macro'; import tw from 'twin.macro';
import { GLOBAL_POPUP_Z_INDEX, PopupZLevel, themeColor } from '../helpers'; import { GLOBAL_POPUP_Z_INDEX, PopupZLevel, themeColor } from '../helpers';
import { findAnchor } from '../helpers/dom'; import { findAnchor } from '../helpers/dom';
import { ButtonLink, ButtonPrimary, WrapperButton } from './buttons';
import { ButtonPrimary } from '../sonar-aligned/components/buttons';
import { ButtonLink, WrapperButton } from './buttons';
import { CloseIcon } from './icons'; import { CloseIcon } from './icons';
import { PopupWrapper } from './popups'; import { PopupWrapper } from './popups';



+ 1
- 1
server/sonar-web/design-system/src/components/Tabs.tsx 查看文件

import tw from 'twin.macro'; import tw from 'twin.macro';
import { OPACITY_20_PERCENT, themeBorder, themeColor } from '../helpers'; import { OPACITY_20_PERCENT, themeBorder, themeColor } from '../helpers';
import { getTabId, getTabPanelId } from '../helpers/tabs'; import { getTabId, getTabPanelId } from '../helpers/tabs';
import { BareButton } from '../sonar-aligned/components/buttons';
import { Badge } from './Badge'; import { Badge } from './Badge';
import { BareButton } from './buttons';


type TabValueType = string | number | boolean; type TabValueType = string | number | boolean;



+ 1
- 1
server/sonar-web/design-system/src/components/TextAccordion.tsx 查看文件

import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeColor } from '../helpers'; import { themeColor } from '../helpers';
import { BareButton } from '../sonar-aligned/components/buttons';
import { Note } from './Text'; import { Note } from './Text';
import { BareButton } from './buttons';
import { OpenCloseIndicator } from './icons'; import { OpenCloseIndicator } from './icons';


interface Props { interface Props {

+ 1
- 1
server/sonar-web/design-system/src/components/ToggleButton.tsx 查看文件

import tw from 'twin.macro'; import tw from 'twin.macro';
import { getTabId, getTabPanelId } from '../helpers/tabs'; import { getTabId, getTabPanelId } from '../helpers/tabs';
import { themeBorder, themeColor, themeContrast } from '../helpers/theme'; import { themeBorder, themeColor, themeContrast } from '../helpers/theme';
import { ButtonSecondary } from '../sonar-aligned/components/buttons';
import { Badge } from './Badge'; import { Badge } from './Badge';
import { ButtonSecondary } from './buttons';


type ToggleButtonValueType = string | number | boolean; type ToggleButtonValueType = string | number | boolean;



+ 1
- 1
server/sonar-web/design-system/src/components/__tests__/Dropdown-test.tsx 查看文件

*/ */
import { screen } from '@testing-library/react'; import { screen } from '@testing-library/react';
import { renderWithRouter } from '../../helpers/testUtils'; import { renderWithRouter } from '../../helpers/testUtils';
import { ButtonSecondary } from '../../sonar-aligned/components/buttons';
import { ActionsDropdown, Dropdown } from '../Dropdown'; import { ActionsDropdown, Dropdown } from '../Dropdown';
import { ButtonSecondary } from '../buttons';


describe('Dropdown', () => { describe('Dropdown', () => {
it('renders', async () => { it('renders', async () => {

+ 1
- 9
server/sonar-web/design-system/src/components/buttons/BareButtons.tsx 查看文件

import styled from '@emotion/styled'; import styled from '@emotion/styled';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeBorder, themeColor, themeContrast } from '../../helpers'; import { themeBorder, themeColor, themeContrast } from '../../helpers';

export const BareButton = styled.button`
all: unset;
cursor: pointer;

&:focus-visible {
background-color: ${themeColor('dropdownMenuHover')};
}
`;
import { BareButton } from '../../sonar-aligned/components/buttons';


interface CodeViewerExpanderProps { interface CodeViewerExpanderProps {
direction: 'UP' | 'DOWN'; direction: 'UP' | 'DOWN';

+ 1
- 1
server/sonar-web/design-system/src/components/buttons/ButtonLink.tsx 查看文件

import styled from '@emotion/styled'; import styled from '@emotion/styled';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeBorder, themeColor } from '../../helpers'; import { themeBorder, themeColor } from '../../helpers';
import { BareButton } from './BareButtons';
import { BareButton } from '../../sonar-aligned/components/buttons';


export const ButtonLink = styled(BareButton)` export const ButtonLink = styled(BareButton)`
color: ${themeColor('linkDefault')}; color: ${themeColor('linkDefault')};

+ 1
- 2
server/sonar-web/design-system/src/components/buttons/DownloadButton.tsx 查看文件

* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { buttonStyle } from './Button';
import { PrimaryStyle } from './ButtonPrimary';
import { buttonStyle, PrimaryStyle } from '../../sonar-aligned/components/buttons';


export const DownloadButton = styled.a` export const DownloadButton = styled.a`
${buttonStyle} ${buttonStyle}

+ 1
- 1
server/sonar-web/design-system/src/components/buttons/WrapperButton.tsx 查看文件

*/ */
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { OPACITY_20_PERCENT, themeColor } from '../../helpers'; import { OPACITY_20_PERCENT, themeColor } from '../../helpers';
import { Button, ButtonProps } from './Button';
import { Button, ButtonProps } from '../../sonar-aligned/components/buttons';


export const WrapperButton: React.FC<React.PropsWithChildren<ButtonProps>> = styled(Button)` export const WrapperButton: React.FC<React.PropsWithChildren<ButtonProps>> = styled(Button)`
--background: none; --background: none;

+ 0
- 6
server/sonar-web/design-system/src/components/buttons/index.ts 查看文件

* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
export * from './BareButtons'; export * from './BareButtons';
export * from './Button';
export * from './ButtonLink'; export * from './ButtonLink';
export * from './ButtonPrimary';
export * from './ButtonSecondary';
export * from './DangerButtonPrimary';
export * from './DangerButtonSecondary';
export * from './DownloadButton'; export * from './DownloadButton';
export * from './ThirdPartyButton';
export * from './WrapperButton'; export * from './WrapperButton';

+ 1
- 1
server/sonar-web/design-system/src/components/clipboard.tsx 查看文件

import Clipboard from 'clipboard'; import Clipboard from 'clipboard';
import React from 'react'; import React from 'react';
import { INTERACTIVE_TOOLTIP_DELAY } from '../helpers/constants'; import { INTERACTIVE_TOOLTIP_DELAY } from '../helpers/constants';
import { ButtonSecondary } from '../sonar-aligned/components/buttons';
import { DiscreetInteractiveIcon, InteractiveIcon, InteractiveIconSize } from './InteractiveIcon'; import { DiscreetInteractiveIcon, InteractiveIcon, InteractiveIconSize } from './InteractiveIcon';
import { Tooltip } from './Tooltip'; import { Tooltip } from './Tooltip';
import { ButtonSecondary } from './buttons';
import { CopyIcon } from './icons/CopyIcon'; import { CopyIcon } from './icons/CopyIcon';
import { IconProps } from './icons/Icon'; import { IconProps } from './icons/Icon';



+ 1
- 1
server/sonar-web/design-system/src/components/code-line/LineFinding.tsx 查看文件

import { forwardRef, Ref } from 'react'; import { forwardRef, Ref } from 'react';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeBorder, themeColor, themeContrast, themeShadow } from '../../helpers/theme'; import { themeBorder, themeColor, themeContrast, themeShadow } from '../../helpers/theme';
import { BareButton } from '../buttons';
import { BareButton } from '../../sonar-aligned/components/buttons';


interface Props { interface Props {
className?: string; className?: string;

+ 1
- 1
server/sonar-web/design-system/src/components/input/FileInput.tsx 查看文件

*/ */
import classNames from 'classnames'; import classNames from 'classnames';
import { useCallback, useRef, useState } from 'react'; import { useCallback, useRef, useState } from 'react';
import { ButtonSecondary } from '../../sonar-aligned/components/buttons/ButtonSecondary';
import { Note } from '../Text'; import { Note } from '../Text';
import { ButtonSecondary } from '../buttons/ButtonSecondary';


interface Props { interface Props {
chooseLabel: string; chooseLabel: string;

+ 2
- 1
server/sonar-web/design-system/src/components/input/InputMultiSelect.tsx 查看文件

import styled from '@emotion/styled'; import styled from '@emotion/styled';
import classNames from 'classnames'; import classNames from 'classnames';
import { themeBorder } from '../../helpers'; import { themeBorder } from '../../helpers';
import { ButtonProps } from '../../sonar-aligned/components/buttons';
import { Badge } from '../Badge'; import { Badge } from '../Badge';
import { LightLabel } from '../Text'; import { LightLabel } from '../Text';
import { ButtonProps, WrapperButton } from '../buttons';
import { WrapperButton } from '../buttons';
import { ChevronDownIcon } from '../icons'; import { ChevronDownIcon } from '../icons';


interface Props extends Pick<ButtonProps, 'onClick'> { interface Props extends Pick<ButtonProps, 'onClick'> {

+ 1
- 1
server/sonar-web/design-system/src/components/modal/Modal.tsx 查看文件

import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeColor } from '../../helpers'; import { themeColor } from '../../helpers';
import { REACT_DOM_CONTAINER } from '../../helpers/constants'; import { REACT_DOM_CONTAINER } from '../../helpers/constants';
import { ButtonSecondary } from '../../sonar-aligned/components/buttons';
import { Theme } from '../../types/theme'; import { Theme } from '../../types/theme';
import { ButtonSecondary } from '../buttons';
import { ModalBody } from './ModalBody'; import { ModalBody } from './ModalBody';
import { ModalFooter } from './ModalFooter'; import { ModalFooter } from './ModalFooter';
import { ModalHeader } from './ModalHeader'; import { ModalHeader } from './ModalHeader';

+ 1
- 1
server/sonar-web/design-system/src/components/subnavigation/SubnavigationAccordion.tsx 查看文件

import { ReactNode, useCallback, useState } from 'react'; import { ReactNode, useCallback, useState } from 'react';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeColor, themeContrast } from '../../helpers/theme'; import { themeColor, themeContrast } from '../../helpers/theme';
import { BareButton } from '../buttons';
import { BareButton } from '../../sonar-aligned/components/buttons';
import { OpenCloseIndicator } from '../icons/OpenCloseIndicator'; import { OpenCloseIndicator } from '../icons/OpenCloseIndicator';
import { SubnavigationGroup } from './SubnavigationGroup'; import { SubnavigationGroup } from './SubnavigationGroup';



+ 30
- 0
server/sonar-web/design-system/src/sonar-aligned/components/buttons/BareButton.tsx 查看文件

/*
* SonarQube
* Copyright (C) 2009-2024 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 styled from '@emotion/styled';
import { themeColor } from '../../../helpers';

export const BareButton = styled.button`
all: unset;
cursor: pointer;

&:focus-visible {
background-color: ${themeColor('dropdownMenuHover')};
}
`;

server/sonar-web/design-system/src/components/buttons/Button.tsx → server/sonar-web/design-system/src/sonar-aligned/components/buttons/Button.tsx 查看文件

import styled from '@emotion/styled'; import styled from '@emotion/styled';
import React from 'react'; import React from 'react';
import tw from 'twin.macro'; import tw from 'twin.macro';
import { themeBorder, themeColor, themeContrast } from '../../helpers/theme';
import { ThemedProps } from '../../types/theme';
import { BaseLink, LinkProps } from '../Link';
import { BaseLink, LinkProps } from '../../../components/Link';
import { themeBorder, themeColor, themeContrast } from '../../../helpers/theme';
import { ThemedProps } from '../../../types/theme';


type AllowedButtonAttributes = Pick< type AllowedButtonAttributes = Pick<
React.ButtonHTMLAttributes<HTMLButtonElement>, React.ButtonHTMLAttributes<HTMLButtonElement>,
icon?: React.ReactNode; icon?: React.ReactNode;
innerRef?: React.Ref<HTMLButtonElement>; innerRef?: React.Ref<HTMLButtonElement>;
isExternal?: LinkProps['isExternal']; isExternal?: LinkProps['isExternal'];
onClick?: (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => unknown;


onClick?: (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => unknown;
preventDefault?: boolean; preventDefault?: boolean;
reloadDocument?: LinkProps['reloadDocument']; reloadDocument?: LinkProps['reloadDocument'];
showExternalIcon?: boolean;
stopPropagation?: boolean; stopPropagation?: boolean;
target?: LinkProps['target']; target?: LinkProps['target'];
to?: LinkProps['to']; to?: LinkProps['to'];

server/sonar-web/design-system/src/components/buttons/ButtonPrimary.tsx → server/sonar-web/design-system/src/sonar-aligned/components/buttons/ButtonPrimary.tsx 查看文件

*/ */
import { css } from '@emotion/react'; import { css } from '@emotion/react';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { OPACITY_20_PERCENT, themeBorder, themeColor, themeContrast } from '../../helpers';
import { ThemedProps } from '../../types';
import { OPACITY_20_PERCENT, themeBorder, themeColor, themeContrast } from '../../../helpers';
import { ThemedProps } from '../../../types';
import { Button, ButtonProps } from './Button'; import { Button, ButtonProps } from './Button';


export const PrimaryStyle = (props: ThemedProps) => css` export const PrimaryStyle = (props: ThemedProps) => css`

server/sonar-web/design-system/src/components/buttons/ButtonSecondary.tsx → server/sonar-web/design-system/src/sonar-aligned/components/buttons/ButtonSecondary.tsx 查看文件

* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { OPACITY_20_PERCENT, themeBorder, themeColor, themeContrast } from '../../helpers';
import { OPACITY_20_PERCENT, themeBorder, themeColor, themeContrast } from '../../../helpers';
import { Button, ButtonProps } from './Button'; import { Button, ButtonProps } from './Button';


export const ButtonSecondary: React.FC<React.PropsWithChildren<ButtonProps>> = styled(Button)` export const ButtonSecondary: React.FC<React.PropsWithChildren<ButtonProps>> = styled(Button)`

server/sonar-web/design-system/src/components/buttons/DangerButtonPrimary.tsx → server/sonar-web/design-system/src/sonar-aligned/components/buttons/DangerButtonPrimary.tsx 查看文件

* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { OPACITY_20_PERCENT, themeBorder, themeColor, themeContrast } from '../../helpers';
import { OPACITY_20_PERCENT, themeBorder, themeColor, themeContrast } from '../../../helpers';
import { Button, ButtonProps } from './Button'; import { Button, ButtonProps } from './Button';


export const DangerButtonPrimary: React.FC<React.PropsWithChildren<ButtonProps>> = styled(Button)` export const DangerButtonPrimary: React.FC<React.PropsWithChildren<ButtonProps>> = styled(Button)`

server/sonar-web/design-system/src/components/buttons/DangerButtonSecondary.tsx → server/sonar-web/design-system/src/sonar-aligned/components/buttons/DangerButtonSecondary.tsx 查看文件

* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { OPACITY_20_PERCENT, themeBorder, themeColor, themeContrast } from '../../helpers';
import { OPACITY_20_PERCENT, themeBorder, themeColor, themeContrast } from '../../../helpers';
import { Button, ButtonProps } from './Button'; import { Button, ButtonProps } from './Button';


export const DangerButtonSecondary: React.FC<React.PropsWithChildren<ButtonProps>> = styled(Button)` export const DangerButtonSecondary: React.FC<React.PropsWithChildren<ButtonProps>> = styled(Button)`

server/sonar-web/design-system/src/components/buttons/ThirdPartyButton.tsx → server/sonar-web/design-system/src/sonar-aligned/components/buttons/ThirdPartyButton.tsx 查看文件

*/ */
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import React from 'react'; import React from 'react';
import { OPACITY_20_PERCENT } from '../../helpers/constants';
import { themeBorder, themeColor, themeContrast } from '../../helpers/theme';
import { OPACITY_20_PERCENT } from '../../../helpers/constants';
import { themeBorder, themeColor, themeContrast } from '../../../helpers/theme';
import { Button, ButtonProps } from './Button'; import { Button, ButtonProps } from './Button';


interface ThirdPartyProps extends Omit<ButtonProps, 'Icon'> { interface ThirdPartyProps extends Omit<ButtonProps, 'Icon'> {

server/sonar-web/design-system/src/components/buttons/__tests__/ButtonPrimary-test.tsx → server/sonar-web/design-system/src/sonar-aligned/components/buttons/__tests__/ButtonPrimary-test.tsx 查看文件


+ 27
- 0
server/sonar-web/design-system/src/sonar-aligned/components/buttons/index.ts 查看文件

/*
* SonarQube
* Copyright (C) 2009-2024 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.
*/

export * from './BareButton';
export * from './Button';
export * from './ButtonPrimary';
export * from './ButtonSecondary';
export * from './DangerButtonPrimary';
export * from './DangerButtonSecondary';
export * from './ThirdPartyButton';

+ 1
- 0
server/sonar-web/design-system/src/sonar-aligned/components/index.ts 查看文件



export * from './Card'; export * from './Card';
export * from './MetricsRatingBadge'; export * from './MetricsRatingBadge';
export * from './buttons';

正在加载...
取消
保存