Skip to content

Commit

Permalink
Merge branch 'master' into play-1682
Browse files Browse the repository at this point in the history
  • Loading branch information
Lsimmons98 authored Jan 3, 2025
2 parents e634be5 + 3ac14d5 commit 723a44a
Show file tree
Hide file tree
Showing 42 changed files with 832 additions and 90 deletions.
2 changes: 1 addition & 1 deletion playbook-website/config/menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ kits:
enhanced_element_used: false
- name: skeleton_loading
platforms: *1
status: beta
status: stable
icons_used: false
react_rendered: false
enhanced_element_used: false
Expand Down
14 changes: 1 addition & 13 deletions playbook/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ $pb_icon_circle_sizes: (
"xl": 100px,
);

@mixin svg_size($name, $match, $adjust) {
@if $name == $match {
$svg_xy: $adjust;
& > svg {
width: #{$svg_xy};
height: #{$svg_xy};
}
}
}

[class^=pb_icon_circle_kit] {
display: flex;
justify-content: center;
Expand Down Expand Up @@ -57,13 +47,11 @@ $pb_icon_circle_sizes: (
border-radius: $size/2;
background: $silver;
color: $text_lt_light;
font-size: $size * 0.38;
font-size: if($name == "xxs", $size - 6px, $size * 0.38);
line-height: $size;
flex-shrink: 0;
flex-grow: 0;
flex-basis: $size;

@include svg_size($name, "xxs", $size - 6px);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
@import "../tokens/opacity";
@import "./section_separator_mixin";

$merge_kits1: map-merge($status_colors, $category_colors);
$merge_kits2: map-merge($merge_kits1, $product_colors);
$merge_kits3: map-merge($merge_kits2, $text_colors);
$section_selector_colors: map-merge($merge_kits3, $data_colors);

$section_colors_light: (
background: $bg_light,
card: $card_light,
Expand All @@ -19,8 +24,11 @@ $section_colors_dark: (
align-items: center;
position: relative;
span {
padding: 0 $space_xs;
padding: 0;
display: flex;
[class*="pb_caption_kit"] {
padding: 0 $space_xs;
}
}
&::before {
content: "";
Expand All @@ -34,12 +42,40 @@ $section_colors_dark: (
flex: 1;
@include section_separator_horizontal;
}
@each $color_name, $color_value in $section_selector_colors {
&[class*="color_#{$color_name}"] {
&::before, &::after {
background: $color_value;
}

&[class*=_vertical] {
&::after {
background: $color_value;
}
}
&[class*=_dashed] {
&::before, &::after {
border: 1px dashed $color_value;
}
&[class*=_vertical] {
&::after {
border: 1px dashed $color_value;
background: none;
}
}
}
}
}

&[class*=_horizontal] {
justify-content: center;
}
&[class*=_vertical] {
margin-left: $space_xs;
margin-right: $space_xs;
&::before {
display: none;
}
&::after {
@include section_separator_vertical(false);
}
Expand All @@ -54,6 +90,33 @@ $section_colors_dark: (
// Dark =========================

&.dark {
@each $color_name, $color_value in $section_selector_colors {
&[class*="color_#{$color_name}"] {
&::before, &::after {
background: $color_value;
}

&[class*=_vertical] {
&::after {
@include section_separator_vertical(false);
background: $color_value;
}
}

&[class*=_dashed] {
&::before, &::after {
border: 1px dashed $color_value;
background: none;
}
&[class*=_vertical] {
&::after {
border: 1px dashed $color_value;
background: none;
}
}
}
}
}
&::before {
@include section_separator_horizontal(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type SectionSeparatorProps = {
aria?: { [key: string]: string; },
children?: React.ReactChild[] | React.ReactChild,
className?: string,
color?: "default" | "primary",
dark?: boolean,
data?: { [key: string]: string; },
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
Expand All @@ -25,6 +26,7 @@ const SectionSeparator = (props: SectionSeparatorProps): React.ReactElement => {
aria = {},
children,
className,
color ="default",
data = {},
htmlOptions = {},
id,
Expand All @@ -37,7 +39,7 @@ const SectionSeparator = (props: SectionSeparatorProps): React.ReactElement => {
const ariaProps = buildAriaProps(aria)
const dataProps = buildDataProps(data)
const htmlProps = buildHtmlProps(htmlOptions)
const classes = classnames(buildCss('pb_section_separator_kit', variant, orientation, lineStyle === "dashed" ? lineStyle : ""), globalProps(props), className)
const classes = classnames(buildCss('pb_section_separator_kit', variant, orientation, lineStyle === "dashed" ? lineStyle : "", color !== "default" ? `color_${color}` : ''), globalProps(props), className)
const dynamicInlineProps = globalInlineProps(props)

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%= pb_rails("section_separator", props: { text: "Default Separator" }) %>
<%= pb_rails("section_separator", props: { color: "primary", text: "Primary Separator" }) %>
<%= pb_rails("section_separator", props: { color: "primary", line_style: "dashed", text: "Primary Dashed Separator" }) %>
<%= pb_rails("section_separator", props: { color: "primary" }) do %>
<%= pb_rails("flex", props: { padding: "xs" }) do %>
<%= pb_rails("icon", props: { color: "primary", icon: "arrow-down" }) %>
<%= pb_rails("detail", props: { text: "Children", size: "sm", color: "link" }) %>
<% end %>
<% end %>

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from "react"
import { SectionSeparator, Flex, Detail, Icon } from "playbook-ui"

const children = (
<Flex padding="xs">
<Icon color="primary"
icon="arrow-down"
/>
<Detail
color="link"
size="sm"
text="Children"
/>
</Flex>
)

const SectionSeparatorColor = (props) => {
return (
<div>
<SectionSeparator text="Default Separator"
{...props}
/>
<SectionSeparator color="primary"
text="Primary Separator"
{...props}
/>
<SectionSeparator
color="primary"
lineStyle="dashed"
text="Primary Dashed Separator"
{...props}
/>
<SectionSeparator color="primary"
{...props}
>
{children}
</SectionSeparator>
</div>
)
}

export default SectionSeparatorColor
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Pass "primary" to the `color` prop to change any section separator color.

**NOTE:** Passing `children` overrides any content provided via the `text` prop. The `color` prop does not affect the `text` prop's color, and the color of `children` is determined by the children's individual props. For greater control over text color customization, consider using a separator with `children`.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ examples:
- section_separator_text: Text Separator
- section_separator_vertical: Vertical
- section_separator_children: Children
- section_separator_color: Color

react:
- section_separator_line: Line Separator
- section_separator_dashed: Dashed Separator
- section_separator_text: Text Separator
- section_separator_vertical: Vertical
- section_separator_children: Children
- section_separator_color: Color

swift:
- section_separator_line_swift: Line Separator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export { default as SectionSeparatorText } from './_section_separator_text.jsx'
export { default as SectionSeparatorVertical } from './_section_separator_vertical.jsx'
export { default as SectionSeparatorDashed } from './_section_separator_dashed.jsx'
export { default as SectionSeparatorChildren } from './_section_separator_children.jsx'
export { default as SectionSeparatorColor } from './_section_separator_color.jsx'
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
module Playbook
module PbSectionSeparator
class SectionSeparator < Playbook::KitBase
prop :color, type: Playbook::Props::Enum,
values: %w[default primary],
default: "default"
prop :text
prop :variant, type: Playbook::Props::Enum,
values: %w[card background],
Expand All @@ -17,7 +20,7 @@ class SectionSeparator < Playbook::KitBase
default: "solid"

def classname
generate_classname("pb_section_separator_kit", variant, orientation, line_style == "dashed" ? "dashed" : nil)
generate_classname("pb_section_separator_kit", variant, orientation, line_style == "dashed" ? "dashed" : nil, color != "default" ? "color_#{color}" : nil)
end

private
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import 'skeleton_loading_mixins';

.pb_skeleton_loading {
display: "flex";
flex-direction: "column";
display: flex;
flex-direction: column;
height: 100%;
.color_default {
@include skeleton-shimmer($silver);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The Skeleton Loading kit can be used an intermediate loading state to give users a visual indication that content is loading.

**Please Note**: this kit is not meant to be integrated interally within other Playbook kits as a loading prop; rather, it can be used to create a composite of the section/kit/page with loading intermediataries, as demonstrated in the the "example component" doc examples.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<%= pb_rails("flex", props: { justify: "evenly" }) do %>
<%= pb_rails("skeleton_loading", props: { border_radius: "rounded", height: "50px", width: "100px"}) %>
<%= pb_rails("skeleton_loading", props: { border_radius: "xl", height: "50px", width: "100px"}) %>
<%= pb_rails("skeleton_loading", props: { border_radius: "lg", height: "50px", width: "100px"}) %>
<%= pb_rails("skeleton_loading", props: { border_radius: "md", height: "50px", width: "100px"}) %>
<%= pb_rails("skeleton_loading", props: { height: "50px", width: "100px"}) %>
<%= pb_rails("skeleton_loading", props: { border_radius: "xs", height: "50px", width: "100px"}) %>
<%= pb_rails("skeleton_loading", props: { border_radius: "none", height: "50px", width: "100px"}) %>
<% end %>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `border_radius` prop accepts all of our [BorderRadius](https://playbook.powerapp.cloud/visual_guidelines/border_radius) tokens, with `sm` as default.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%= pb_rails("card", props: { border_none: true }) do %>
<%= pb_rails("skeleton_loading") %>
<% end %>

<%= pb_rails("card", props: { background: "light", border_none: true }) do %>
<%= pb_rails("skeleton_loading", props: { color: "white" }) %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= pb_rails("skeleton_loading") %>
<%= pb_rails("skeleton_loading") %>
Loading

0 comments on commit 723a44a

Please sign in to comment.