Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ButtonGroup): move files to folder. #3117

Merged
merged 24 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e8a0d6b
Reorganize ButtonGroup component and stories.
radglob Apr 4, 2023
459969c
Update generated/components.json
radglob Apr 4, 2023
e8230ed
Add e2e tests.
radglob Apr 4, 2023
4f009f2
test(vrt): update snapshots
radglob Apr 4, 2023
9d33f74
refactor(CircleBadge): move files into folder, add e2e tests. (#3118)
radglob Apr 4, 2023
fcc34dc
replace createRef with useRef (#3124)
mattcosta7 Apr 5, 2023
7d774b1
refactor(FilterList): add files to folder, add storybook and e2e test…
radglob Apr 5, 2023
8243a2f
Refactor(FilteredSearch): move files to folder, add storybook and e2e…
radglob Apr 6, 2023
0355521
Refactor(LabelGroup): add files to folder, add storybook and e2e test…
radglob Apr 6, 2023
5888d44
test(e2e): update ActionMenu e2e test to remove custom contrast rules…
joshblack Apr 6, 2023
1f13d5b
NavList SSR: use useIsomorphicLayoutEffect instead of useLayoutEffect…
siddharthkp Apr 6, 2023
6fb6baf
Bump @primer/primitives to `7.11.5` (#3120)
simurai Apr 7, 2023
aca66a6
Update RelativeTime stories (#3136)
colebemis Apr 7, 2023
70ad805
chore(deps-dev): bump @types/jest-axe from 3.5.3 to 3.5.5 (#3141)
dependabot[bot] Apr 10, 2023
b50de0a
chore(deps-dev): bump @rollup/plugin-typescript from 11.0.0 to 11.1.0…
dependabot[bot] Apr 10, 2023
2c71540
chore(deps-dev): bump eslint-plugin-primer-react from 2.0.2 to 2.0.3 …
dependabot[bot] Apr 10, 2023
58f8522
chore(deps-dev): bump babel-plugin-styled-components from 2.0.2 to 2.…
dependabot[bot] Apr 10, 2023
d6e0edf
chore(project): update project to use Node.js v18 LTS (#3133)
joshblack Apr 10, 2023
eb4cd28
Use SSR-compatible slot implementation in CheckboxGroup/RadioGroup (#…
colebemis Apr 10, 2023
a9e09d0
Add segments to progressbar (#3114)
radglob Apr 11, 2023
8665c91
Merge branch 'main' into reorg-button-group-stories
radglob Apr 11, 2023
f534c1a
Update generated/components.json
radglob Apr 11, 2023
68ba31c
Merge branch 'main' of github.com:primer/react into reorg-button-grou…
radglob Apr 11, 2023
32ab348
Merge branch 'main' into reorg-button-group-stories
radglob Apr 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/content/ButtonGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ source: https://github.com/primer/react/tree/main/src/ButtonGroup
storybook: '/react/storybook?path=/story/components-buttongroup--default'
---

import data from '../../src/ButtonGroup.docs.json'
import data from '../../src/ButtonGroup/ButtonGroup.docs.json'

```js
import {ButtonGroup} from '@primer/react'
Expand Down
89 changes: 89 additions & 0 deletions e2e/components/ButtonGroup.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

test.describe('ButtonGroup', () => {
test.describe('Default', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-buttongroup--default',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`ButtonGroup.Default.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-buttongroup--default',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

test.describe('Playground', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-buttongroup--playground',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`ButtonGroup.Playground.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-buttongroup--playground',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})

test.describe('Icon Buttons', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-buttongroup-features--icon-buttons',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`ButtonGroup.Icon Buttons.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-buttongroup-features--icon-buttons',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations()
})
})
}
})
})
41 changes: 23 additions & 18 deletions generated/components.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
{
"schemaVersion": 2,
"components": {
"button_group": {
"id": "button_group",
"name": "ButtonGroup",
"status": "alpha",
"a11yReviewed": false,
"stories": [],
"props": [
{
"name": "sx",
"type": "SystemStyleObject"
},
{
"name": "ref",
"type": "React.RefObject<HTMLDivElement>"
}
],
"subcomponents": []
},
"circle_badge": {
"id": "circle_badge",
"name": "CircleBadge",
Expand Down Expand Up @@ -1562,6 +1544,29 @@
],
"subcomponents": []
},
"button_group": {
"id": "button_group",
"name": "ButtonGroup",
"status": "alpha",
"a11yReviewed": false,
"stories": [
{
"id": "components-buttongroup--default",
"code": "() => (\n <ButtonGroup>\n <Button>Button 1</Button>\n <Button>Button 2</Button>\n <Button>Button 3</Button>\n </ButtonGroup>\n)"
}
],
"props": [
{
"name": "sx",
"type": "SystemStyleObject"
},
{
"name": "ref",
"type": "React.RefObject<HTMLDivElement>"
}
],
"subcomponents": []
},
"checkbox": {
"id": "checkbox",
"name": "Checkbox",
Expand Down
19 changes: 19 additions & 0 deletions script/generate-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,25 @@ const components = new Map([
],
},
],
[
'ButtonGroup',
{
stories: [
{
id: 'components-buttongroup--default',
name: 'Default',
},
{
id: 'components-buttongroup--playground',
name: 'Playground',
},
{
id: 'components-buttongroup-features--icon-buttons',
name: 'Icon Buttons',
},
],
},
],
[
'Breadcrumbs',
{
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions src/ButtonGroup/ButtonGroup.features.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'
import {ComponentMeta} from '@storybook/react'
import ButtonGroup from './ButtonGroup'
import {IconButton} from '../Button'
import {PlusIcon, DashIcon} from '@primer/octicons-react'

export default {
title: 'Components/ButtonGroup/Features',
component: ButtonGroup,
} as ComponentMeta<typeof ButtonGroup>

export const IconButtons = () => (
<ButtonGroup>
<IconButton icon={PlusIcon} aria-label="Add" />
<IconButton icon={DashIcon} aria-label="Subtract" />
</ButtonGroup>
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react'
import {Story, Meta} from '@storybook/react'
import ButtonGroup from '../ButtonGroup'
import {Button, ButtonProps, IconButton} from '../Button'
import {PlusIcon, DashIcon} from '@primer/octicons-react'
import ButtonGroup from './ButtonGroup'
import {Button, ButtonProps} from '../Button'

export default {
title: 'Components/ButtonGroup',
Expand Down Expand Up @@ -48,10 +47,3 @@ Playground.argTypes = {
},
},
}

export const IconButtons = () => (
<ButtonGroup>
<IconButton icon={PlusIcon} aria-label="Add" />
<IconButton icon={DashIcon} aria-label="Subtract" />
</ButtonGroup>
)
6 changes: 3 additions & 3 deletions src/ButtonGroup.tsx → src/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from 'styled-components'
import {get} from './constants'
import sx from './sx'
import {ComponentProps} from './utils/types'
import {get} from '../constants'
import sx from '../sx'
import {ComponentProps} from '../utils/types'

const ButtonGroup = styled.div`
display: inline-flex;
Expand Down
1 change: 1 addition & 0 deletions src/ButtonGroup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default, ButtonGroupProps} from './ButtonGroup'