-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Testimonial variants and FrostedGlassVFX component (#863)
- Loading branch information
Showing
43 changed files
with
983 additions
and
188 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@primer/react-brand': patch | ||
--- | ||
|
||
Added new `Testimonial` variants. | ||
|
||
Use `variant="default"` or `variant="subtle"` for an alternative visual appearance. The current design will be referred to as `minimal` going forward. | ||
|
||
🔗 [See the documentation for usage examples](https://primer.style/brand/components/Testimonial/react#variants) |
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,18 @@ | ||
--- | ||
'@primer/brand-primitives': patch | ||
--- | ||
|
||
Added new design tokens for `Testimonial` and `FrostedGlassVFX` components | ||
|
||
``` | ||
:root { | ||
--brand-Testimonial-borderMask-default | ||
--brand-Testimonial-borderMask-subtle | ||
--brand-FrostedGlassVFX-bgColor | ||
--brand-FrostedGlassVFX-boxShadow | ||
--brand-FrostedGlassVFX-borderMask | ||
--brand-FrostedGlassVFX-blurIntensity-high | ||
--brand-FrostedGlassVFX-blurIntensity-medium | ||
--brand-FrostedGlassVFX-blurIntensity-low | ||
} | ||
``` |
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,26 @@ | ||
--- | ||
'@primer/react-brand': minor | ||
--- | ||
|
||
Added a new `FrostedGlassVFX` component for applying a frosted glass-effect texture to nested components. | ||
|
||
⚠️ This is an experimental component, and not tested for compatibility with other Primer Brand components. | ||
|
||
When using this component, ensure there is sufficient contrast between the foreground text and the background imagery, as the frosted glass effect can significantly reduce legibility. | ||
|
||
Usage example: | ||
|
||
```jsx | ||
<FrostedGlassVFX> | ||
<Testimonial variant="default"> | ||
<Testimonial.Quote> | ||
GitHub helps us ensure that we have our security controls baked into our pipelines all the way from the first line | ||
of code we're writing. | ||
</Testimonial.Quote> | ||
<Testimonial.Name /> | ||
<Testimonial.Avatar /> | ||
</Testimonial> | ||
</FrostedGlassVFX> | ||
``` | ||
|
||
🔗 (See Storybook for an example)[https://primer.style/brand/storybook/?path=/story/components-testimonial-examples--with-frosted-glass] |
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
15 changes: 15 additions & 0 deletions
15
packages/design-tokens/src/tokens/functional/components/frosted-glass-vfx/base.json
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,15 @@ | ||
{ | ||
"FrostedGlassVFX": { | ||
"blurIntensity": { | ||
"low": { | ||
"value": "var(--base-size-12)" | ||
}, | ||
"medium": { | ||
"value": "var(--base-size-48)" | ||
}, | ||
"high": { | ||
"value": "var(--base-size-80)" | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/design-tokens/src/tokens/functional/components/frosted-glass-vfx/colors.js
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,16 @@ | ||
module.exports = { | ||
FrostedGlassVFX: { | ||
bgColor: { | ||
value: 'rgba(255, 255, 255, 0.7)', | ||
dark: 'rgba(156, 156, 156, .1)', | ||
}, | ||
boxShadow: { | ||
value: '0 4px 10px 0 rgba(0, 0, 0, 0.02)', | ||
dark: '0 4px 10px 0 rgba(0, 0, 0, 0.02)', | ||
}, | ||
borderMask: { | ||
value: 'linear-gradient(to bottom, #D8DEE480, #D8DEE45E 100%)', | ||
dark: 'linear-gradient(#000 0 0) exclude, linear-gradient(#000 0 0) content-box', | ||
}, | ||
}, | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/design-tokens/src/tokens/functional/components/testimonial/colors.json
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
44 changes: 44 additions & 0 deletions
44
packages/react/src/FrostedGlassVFX/FrostedGlassVFX.module.css
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,44 @@ | ||
.FrostedGlassVFX { | ||
position: relative; | ||
background-color: var(--brand-FrostedGlassVFX-bgColor); | ||
} | ||
|
||
.FrostedGlassVFX--rounded-corners { | ||
border-radius: var(--brand-borderRadius-xlarge); | ||
} | ||
|
||
.FrostedGlassVFX--intensity-low { | ||
backdrop-filter: blur(var(--brand-FrostedGlassVFX-blurIntensity-low)); | ||
} | ||
|
||
.FrostedGlassVFX--intensity-medium { | ||
backdrop-filter: blur(var(--brand-FrostedGlassVFX-blurIntensity-medium)); | ||
} | ||
|
||
.FrostedGlassVFX--intensity-high { | ||
backdrop-filter: blur(var(--brand-FrostedGlassVFX-blurIntensity-high)); | ||
} | ||
|
||
.FrostedGlassVFX::before { | ||
content: ''; | ||
position: absolute; | ||
z-index: -1; | ||
inset: 0; | ||
padding: var(--brand-borderWidth-thin); | ||
background: var(--brand-FrostedGlassVFX-borderMask); | ||
mask: linear-gradient(var(--base-color-scale-black-0) 0 0) exclude, | ||
linear-gradient(var(--base-color-scale-black-0) 0 0) content-box; | ||
} | ||
|
||
.FrostedGlassVFX--rounded-corners::before { | ||
border-radius: var(--brand-borderRadius-xlarge); | ||
} | ||
|
||
.FrostedGlassVFX > * { | ||
background-color: transparent; | ||
} | ||
|
||
.FrostedGlassVFX > *, | ||
.FrostedGlassVFX > *::before { | ||
border-color: transparent; | ||
} |
9 changes: 9 additions & 0 deletions
9
packages/react/src/FrostedGlassVFX/FrostedGlassVFX.module.css.d.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,9 @@ | ||
declare const styles: { | ||
readonly "FrostedGlassVFX": string; | ||
readonly "FrostedGlassVFX--rounded-corners": string; | ||
readonly "FrostedGlassVFX--intensity-low": string; | ||
readonly "FrostedGlassVFX--intensity-medium": string; | ||
readonly "FrostedGlassVFX--intensity-high": string; | ||
}; | ||
export = styles; | ||
|
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,54 @@ | ||
import React from 'react' | ||
import clsx from 'clsx' | ||
import type {BaseProps} from '../component-helpers' | ||
|
||
/** | ||
* Design tokens | ||
*/ | ||
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/frosted-glass-vfx/base.css' | ||
import '@primer/brand-primitives/lib/design-tokens/css/tokens/functional/components/frosted-glass-vfx/colors-with-modes.css' | ||
|
||
/** * Main Stylesheet (as a CSS Module) */ | ||
import styles from './FrostedGlassVFX.module.css' | ||
|
||
export const FrostedGlassVFXIntensity = ['low', 'medium', 'high'] as const | ||
export type FrostedGlassVFXIntensity = (typeof FrostedGlassVFXIntensity)[number] | ||
export const defaultFrostedGlassVFXIntensity: FrostedGlassVFXIntensity = 'medium' | ||
|
||
export type FrostedGlassVFXProps = BaseProps<HTMLDivElement> & | ||
React.HTMLAttributes<HTMLDivElement> & { | ||
/** | ||
* Applies rounded corners | ||
*/ | ||
hasBorderRadius?: boolean | ||
/** | ||
* Controls the blur amount | ||
*/ | ||
intensity?: FrostedGlassVFXIntensity | ||
} | ||
|
||
/** | ||
* FrostedGlassVFX component | ||
* {@link https://primer.style/brand/components/FrostedGlassVFX/ See usage examples}. | ||
*/ | ||
export function FrostedGlassVFX({ | ||
hasBorderRadius = true, | ||
children, | ||
className, | ||
intensity = defaultFrostedGlassVFXIntensity, | ||
...rest | ||
}: FrostedGlassVFXProps) { | ||
return ( | ||
<div | ||
className={clsx( | ||
styles.FrostedGlassVFX, | ||
hasBorderRadius && styles['FrostedGlassVFX--rounded-corners'], | ||
styles[`FrostedGlassVFX--intensity-${intensity}`], | ||
className, | ||
)} | ||
{...rest} | ||
> | ||
{children} | ||
</div> | ||
) | ||
} |
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 './FrostedGlassVFX' |
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.