Skip to content

Commit

Permalink
Update many-roses-hammer.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pksjce authored Mar 1, 2022
1 parent b11a858 commit c97fd6e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .changeset/many-roses-hammer.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
---
'@primer/react': major
---
### Button
### Button deprecation

A new set of `Button` components brings a much needed update. Previously to `v35`, `Button` was a set of seven independent components. In `v35`, we now have common `Button` usage guidelines and more convenient API.

#### Button variants
We now support a variant property which takes values `primary`, `invisible`, `outline` and `danger`

<table>
<tr>
<th> Before (v34)</th> <th> After (v35)</th>
</tr>
<tr>
<td valign="top">

```jsx
<import {
ButtonPrimary,
Expand All @@ -33,6 +37,7 @@ We now support a variant property which takes values `primary`, `invisible`, `ou
```
</td>
<td valign="top">

```jsx
import {
Button
Expand All @@ -50,69 +55,91 @@ import {
Danger Button
</Button>
```

</td>
</tr>
</table>

### Leading and Trailing icons

In the previous component, we allowed icon components to be direct children. This results in a lot of custom styling for the icon components.
In the new one, we now have `leadinIcon` and `trailingIcon` properties.

<table>
<tr>
<th> Before (v34)</th> <th> After (v35)</th>
</tr>
<tr>
<td valign="top">

```jsx
<Button>
<SearchIcon />
Search
</Button>
```

</td>
<td valign="top">

```jsx
<Button leadingIcon={SearchIcon}>Search</Button>
```

</td>
</tr>
</table>

### Icon buttons

Icon only buttons are common usages in products. So we now have a component for the specific usecase

<table>
<tr>
<th> Before (v34)</th> <th> After (v35)</th>
</tr>
<tr>
<td valign="top">

```jsx
<Button>
<XIcon />
</Button>
```

</td>
<td valign="top">

```jsx
<IconButton aria-label="Close button" icon={XIcon} />
```

</td>
</tr>
</table>

### Size property

Earlier we used `variant` to mean size property. Now we have a new property called `size` which is more semantically correct.

<table>
<tr>
<th> Before (v34)</th> <th> After (v35)</th>
</tr>
<tr>
<td valign="top">

```jsx
<Button variant="small">Small button</Button>
```

</td>
<td valign="top">

```jsx
<Button size="small">Small button</Button>
```

</td>
</tr>
</table>

0 comments on commit c97fd6e

Please sign in to comment.