-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fb8dcc
commit dbe63a1
Showing
15 changed files
with
234 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
polaris-react/src/components/TopBar/components/TopBarButton/TopBarButton.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@import '../../../../styles/common'; | ||
|
||
.TopBarButton { | ||
color: var(--p-color-text); | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: var(--p-height-900); | ||
min-width: var(--p-height-900); | ||
padding: var(--p-space-200); | ||
cursor: pointer; | ||
|
||
@include border-gradient( | ||
var(--p-color-bg-fill), | ||
var(--p-color-border-gradient), | ||
var(--p-border-radius-300) | ||
); | ||
|
||
&:focus { | ||
outline: none; | ||
} | ||
|
||
&:focus-visible { | ||
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY | ||
@include no-focus-ring; | ||
outline: var(--p-border-width-050) solid var(--p-color-border-focus); | ||
outline-offset: var(--p-space-050); | ||
} | ||
|
||
&:hover { | ||
@include update-border-gradient-colors( | ||
var(--p-color-bg-fill-hover), | ||
var(--p-color-border-gradient-hover) | ||
); | ||
} | ||
|
||
&:active, | ||
&[aria-expanded='true'] { | ||
@include update-border-gradient-colors( | ||
var(--p-color-bg-fill-active), | ||
var(--p-color-border-gradient-active) | ||
); | ||
} | ||
|
||
&:active { | ||
@include update-border-gradient-colors( | ||
var(--p-color-bg-fill-selected), | ||
var(--p-color-border-gradient-selected) | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
polaris-react/src/components/TopBar/components/TopBarButton/TopBarButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React, {ButtonHTMLAttributes} from 'react'; | ||
Check failure on line 1 in polaris-react/src/components/TopBar/components/TopBarButton/TopBarButton.tsx GitHub Actions / Validate with Node v18.12.0
|
||
import styles from './TopBarButton.module.scss'; | ||
import {classNames} from '../../../../utilities/css'; | ||
|
||
export function TopBarButton({ | ||
children, | ||
className, | ||
...props | ||
}: ButtonHTMLAttributes<HTMLButtonElement>) { | ||
return ( | ||
<button | ||
type="button" | ||
{...props} | ||
className={classNames(className, styles.TopBarButton)} | ||
> | ||
{children} | ||
</button> | ||
); | ||
} |
1 change: 1 addition & 0 deletions
1
polaris-react/src/components/TopBar/components/TopBarButton/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './TopBarButton'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// Applies a border-gradient effect to an element. | ||
/// @param $backgroundColor - Color of element inside the border. Transparent colors are not supported. | ||
/// @param $borderGradientColor - Color gradient to use for the border | ||
/// @param $borderRadius - Polaris BorderRadiusScale custom property. | ||
@mixin border-gradient( | ||
$backgroundColor: null, | ||
$borderGradientColor: null, | ||
$borderRadius: null | ||
) { | ||
border-radius: $borderRadius; | ||
border: solid var(--p-border-width-025) transparent; | ||
background-color: $backgroundColor; | ||
background-image: linear-gradient($backgroundColor, $backgroundColor), | ||
$borderGradientColor; | ||
background-origin: border-box; | ||
background-clip: padding-box, border-box; | ||
} | ||
|
||
/// Override border gradient colors after setting base border-gradient. | ||
/// This can be used on element state changes like on hover. | ||
/// @param $backgroundColor - Color of element inside the border | ||
/// @param $borderGradientColor - Color gradient to use for the border | ||
@mixin update-border-gradient-colors( | ||
$backgroundColor: null, | ||
$borderGradientColor: null | ||
) { | ||
background-image: linear-gradient($backgroundColor, $backgroundColor), | ||
$borderGradientColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.