Skip to content

Commit

Permalink
Merge pull request #194 from rei/pr/membership
Browse files Browse the repository at this point in the history
pulling in token patch and adding to surface example
  • Loading branch information
mhewson authored Dec 16, 2024
2 parents bf23abd + 73515dd commit dd95b01
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 9 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
}
},
"dependencies": {
"@rei/cdr-tokens": "^12.4.2",
"@rei/cdr-tokens": "^12.4.4",
"tabbable": "^4.0.0"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

.cdr-landing-lead {
//ITEM_DOC: Color of the landing-leads surface layer. Passes to underlying split-surface component
--cdr-split-surface-surface-color: var(--cdr-landing-lead-surface-color, var(--cdr-color-surface-primary, #{$cdr-color-surface-primary}));
--cdr-split-surface-surface-color: var(--cdr-landing-lead-surface-color, var(--cdr-color-background-primary, #{$cdr-color-background-primary}));

&__image {
--cdr-img-aspect-ratio: 4 / 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
&--top {
//ITEM_DOC: Color of the split-surface's surface layer
background: linear-gradient(
var(--cdr-split-surface-surface-color, var(--cdr-color-surface-primary, #{$cdr-color-surface-primary})) 0 50%,
var(--cdr-split-surface-surface-color, var(--cdr-color-background-primary, #{$cdr-color-background-primary})) 0 50%,
transparent 50% 100%,
);
}

&--bottom {
background: linear-gradient(
transparent 0 50%,
var(--cdr-split-surface-surface-color, var(--cdr-color-surface-primary, #{$cdr-color-surface-primary})) 50% 100%,
var(--cdr-split-surface-surface-color, var(--cdr-color-background-primary, #{$cdr-color-background-primary})) 50% 100%,
);
}
}
Expand Down
15 changes: 14 additions & 1 deletion src/components/surface/examples/Surface.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
<script setup lang="ts">
import CdrSurface from '../CdrSurface.vue';
import CdrText from '../../text/CdrText.vue';
import CdrTitle from '../../title/CdrTitle.vue';
import CdrButton from '../../button/CdrButton.vue';
import CdrLink from '../../link/CdrLink.vue';
import type { surface, HtmlAttributes } from '../../../types/interfaces';
defineOptions({ name: 'Surface' });
export interface Example {
label: string;
title: string;
props: surface | HtmlAttributes;
}
const boxes: Example[] = [
{
label: 'This is a blank Surface',
title: 'container title',
props: {},
},
{
label: 'This surface is styled like a card',
title: 'secondary background',
props: {
radius: 'soft',
background: 'secondary',
Expand All @@ -26,6 +32,7 @@ const boxes: Example[] = [
},
{
label: 'This surface is styled like a chip or pill',
title: '',
props: {
radius: 'round',
withBorder: true,
Expand All @@ -35,6 +42,7 @@ const boxes: Example[] = [
},
{
label: 'This surface uses the primary modifier to apply a background but is in the membership-subtle palette ',
title: 'membership-subtle palette',
props: {
class: 'example__card',
palette: 'membership-subtle', // Updated to use membership-subtle palette
Expand All @@ -43,6 +51,7 @@ const boxes: Example[] = [
},
{
label: 'This surface uses the secondary modifier to apply a background it is in the membership-subtle palette, however the palette had no secondary color defined thus default palette values are used ',
title: 'membership-subtle palette',
props: {
class: 'example__card',
palette: 'membership-subtle', // Updated to use membership-subtle palette
Expand All @@ -51,6 +60,7 @@ const boxes: Example[] = [
},
{
label: 'This surface uses the primary modifier to apply a background but is in the membership-vibrant palette ',
title: 'membership-vibrant palette',
props: {
class: 'example__card',
palette: 'membership-vibrant', // Updated to use membership-subtle palette
Expand All @@ -59,6 +69,7 @@ const boxes: Example[] = [
},
{
label: 'This surface uses the secondary modifier to apply a background it is in the membership-vibrant palette, however the palette had no secondary color defined thus default palette values are used ',
title: 'membership-vibrant palette',
props: {
class: 'example__card',
palette: 'membership-vibrant', // Updated to use membership-subtle palette
Expand All @@ -72,12 +83,14 @@ const boxes: Example[] = [
<div class="example">
<h2>Surface</h2>
<template
v-for="{ label, props } in boxes"
v-for="{ label, title, props } in boxes"
:key="label"
>
<hr class="example__hr" />
<CdrSurface v-bind="props">
<CdrTitle>{{ title }}</CdrTitle>
<CdrText>{{ label }}</CdrText>
<CdrButton>Primary button</CdrButton> <cdrLink>and link</cdrLink>
</CdrSurface>
</template>
</div>
Expand Down
10 changes: 10 additions & 0 deletions src/styles/cdr-palette.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,33 @@

[data-palette='membership-subtle'] {
--cdr-color-background-surface-primary: var(--cdr-membership-subtle-color-background-primary, #{$cdr-membership-subtle-color-background-primary});
--cdr-color-background-primary: var(--cdr-membership-subtle-color-background-primary, #{$cdr-membership-subtle-color-background-primary});
--cdr-color-text-surface-primary: var(--cdr-membership-vibrant-color-text-primary, #{$cdr-membership-vibrant-color-text-primary});
--cdr-color-text-primary: var(--cdr-membership-subtle-color-text-primary, #{$cdr-membership-subtle-color-text-primary});
--cdr-color-border-button-primary-rest: var(--cdr-membership-subtle-color-border-button-primary-rest, #{$cdr-membership-subtle-color-border-button-primary-rest});
--cdr-color-border-button-primary-active: var(--cdr-membership-subtle-color-border-button-primary-active, #{$cdr-membership-subtle-color-border-button-primary-active});
--cdr-color-border-button-primary-hover: var(--cdr-membership-subtle-color-border-button-primary-hover, #{$cdr-membership-subtle-color-border-button-primary-hover});
--cdr-color-text-button-primary-hover: var(--cdr-membership-subtle-color-text-button-primary-hover, #{$cdr-membership-subtle-color-text-button-primary-hover});
--cdr-color-background-button-primary-rest: var(--cdr-membership-subtle-color-background-button-primary-rest, #{$cdr-membership-subtle-color-background-button-primary-rest});
--cdr-color-background-button-primary-active: var(--cdr-membership-subtle-color-background-button-primary-active, #{$cdr-membership-subtle-color-background-button-primary-active});
--cdr-color-text-link-rest: var( --cdr-membership-subtle-color-text-link-rest, #{$cdr-membership-subtle-color-text-link-rest});
--cdr-color-text-link-hover: var( --cdr-membership-subtle-color-text-link-hover, #{$cdr-membership-subtle-color-text-link-hover});
--cdr-color-text-link-visited: var( --cdr-membership-subtle-color-text-link-visited, #{$cdr-membership-subtle-color-text-link-visited});
}

[data-palette='membership-vibrant'] {
--cdr-color-background-surface-primary: var(--cdr-membership-vibrant-color-background-primary, #{$cdr-membership-vibrant-color-background-primary});
--cdr-color-background-primary: var(--cdr-membership-vibrant-color-background-primary, #{$cdr-membership-vibrant-color-background-primary});
--cdr-color-text-surface-primary: var(--cdr-membership-vibrant-color-text-primary, #{$cdr-membership-vibrant-color-text-primary});
--cdr-color-text-primary: var(--cdr-membership-vibrant-color-text-primary, #{$cdr-membership-vibrant-color-text-primary});
--cdr-color-border-button-primary-rest: var(--cdr-membership-vibrant-color-border-button-primary-rest, #{$cdr-membership-vibrant-color-border-button-primary-rest});
--cdr-color-border-button-primary-active: var(--cdr-membership-vibrant-color-border-button-primary-active, #{$cdr-membership-vibrant-color-border-button-primary-active});
--cdr-color-border-button-primary-hover: var(--cdr-membership-vibrant-color-border-button-primary-hover, #{$cdr-membership-vibrant-color-border-button-primary-hover});
--cdr-color-text-button-primary-hover: var(--cdr-membership-vibrant-color-text-button-primary-hover, #{$cdr-membership-vibrant-color-text-button-primary-hover});
--cdr-color-background-button-primary-rest: var(--cdr-membership-vibrant-color-background-button-primary-rest, #{$cdr-membership-vibrant-color-background-button-primary-rest});
--cdr-color-background-button-primary-active: var(--cdr-membership-vibrant-color-background-button-primary-active, #{$cdr-membership-vibrant-color-background-button-primary-active});
--cdr-color-text-link-rest: var( --cdr-membership-subtle-color-text-link-rest, #{$cdr-membership-subtle-color-text-link-rest});
--cdr-color-text-link-hover: var( --cdr-membership-subtle-color-text-link-hover, #{$cdr-membership-subtle-color-text-link-hover});
--cdr-color-text-link-visited: var( --cdr-membership-subtle-color-text-link-visited, #{$cdr-membership-subtle-color-text-link-visited});
}

0 comments on commit dd95b01

Please sign in to comment.