-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Responsive Display Global Props (#1846)
* Added conditional to displayProps * Added breakpoint query * Removed commented out code * Trying to display gloabl props * Display global props * Display breakpoints on rails * Working on multiple screen sizes * Display global props at multiple screen sizes * Added Props pill back for display * Separate base types * Fix display.rb css output * Global props work fro single display value * Edited visual guidelines styling * Fixed syntax for display.ts * Switched display.ts syntax back * Fixed syntax error this time * Fix types and SCSS classes * Add breakpoints grid to screen sizes * Don't make changes to unassociated files * All files should have one empty line at the end per code style rules * Add colors type Co-authored-by: Dion Theroulde <[email protected]> Co-authored-by: Stephen Marshall <[email protected]>
- Loading branch information
1 parent
e79ba3d
commit 8ff76c1
Showing
17 changed files
with
260 additions
and
71 deletions.
There are no files selected for viewing
17 changes: 14 additions & 3 deletions
17
playbook-website/app/views/pages/code_snippets/display_in_use_jsx.txt
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 |
---|---|---|
@@ -1,4 +1,15 @@ | ||
<Button display="flex"> | ||
Button Text | ||
<Button/> | ||
<Card display="flex"> | ||
Card content | ||
<Card/> | ||
|
||
<Card | ||
display={ | ||
xs: "hidden", | ||
sm: "flex", | ||
md: "inline", | ||
lg: "inline_block", | ||
xl: "block" | ||
} | ||
> | ||
Card content | ||
<Card/> |
59 changes: 33 additions & 26 deletions
59
playbook-website/app/views/pages/visual_guidelines_partials/_display.html.erb
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 |
---|---|---|
@@ -1,29 +1,36 @@ | ||
<%= pb_rails("title", props: { text: "Display", size: 1, margin_top: "xl", padding_top: "xl" }) %> | ||
<%= pb_rails("body", props: { tag: "p", margin_top: "xs", margin_bottom: "lg" }) do %> | ||
<% end %> | ||
<%= pb_rails("title", props: { text: "Global Props", tag: "h3", size: 4, margin_bottom: "xs" }) %> | ||
<%= pb_rails("body", props: { text: "Available in every kit. These are added globally as they are most flexible when developing.", margin_bottom: "sm" }) %> | ||
<%= pb_rails("title", props: { text: "Display", size: 1, margin_bottom: "sm", margin_top: "xl", padding_top: "xl" }) %> | ||
<%= pb_rails("title", props: { text: "Global Props", tag: "h3", size: 4, margin_bottom: "xs" }) %> | ||
<%= pb_rails("body", props: { text: "Available in every kit. These are added globally as they are most flexible when developing.", margin_bottom: "sm", margin_top: "xs" }) %> | ||
<%= pb_rails("card", props: { shadow: "deep", margin_bottom: "sm", padding: "none" }) do %> | ||
<%= pb_rails("flex", props: { vertical: "stretch", padding_x: "md", padding_top: "md", padding_bottom: "md" }) do %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1" }) do %> | ||
<%= pb_rails("caption", props: { text: "Props", margin_bottom: "sm" }) %> | ||
<%= pb_rails("pill", props: { text: "display", variant: "neutral" }) %> | ||
<% end %> | ||
<%= pb_rails("section_separator", props: { orientation: "vertical", margin_x: "sm" }) %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1" }) do %> | ||
<%= pb_rails("caption", props: { text: "Values", margin_bottom: "sm" }) %> | ||
<%= pb_rails("pill", props: { text: "block", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "inline_block", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "inline", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "flex", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "inline_flex", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "hidden", variant: "warning" }) %> | ||
<% end %> | ||
<%= pb_rails("flex", props: { vertical: "stretch", padding_x: "md", padding_top: "md", padding_bottom: "md" }) do %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1"}) do %> | ||
<%= pb_rails("caption", props: { text: "Props", margin_bottom: "sm" })%> | ||
<%= pb_rails("pill", props: { text: "Display", variant: "neutral"})%> | ||
<% end %> | ||
<%= pb_rails("section_separator", props: { orientation: "vertical", margin_x: "sm" }) %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1" }) do %> | ||
<%= pb_rails("caption", props: { text: " Screen Sizes", margin_bottom: "sm" }) %> | ||
<%= pb_rails("pill", props: { text: "xs", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "sm", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "md", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "lg", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "xl", variant: "warning" }) %> | ||
<% end %> | ||
<%= pb_rails("background", props: { id: "code-wrapper", classname: "border-bottom", background_color: "dark", padding: "none" }) do %> | ||
<%= pb_rails("caption", props: { text: "EXAMPLE IN USE", padding_top: "lg", margin_x: "xl", classname: "dark" }) %> | ||
<div class="pb--codeCopy"> | ||
<pre class="highlight pt_sm" style="margin: 0px"><%= raw rouge(@display_in_use_code_example, "react") %></pre> | ||
</div> | ||
<%= pb_rails("section_separator", props: { orientation: "vertical", margin_x: "sm" }) %> | ||
<%= pb_rails("flex/flex_item", props: { flex: "1" }) do %> | ||
<%= pb_rails("caption", props: { text: "Values", margin_bottom: "sm" }) %> | ||
<%= pb_rails("pill", props: { text: "inline", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "flex", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "inline_block", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "block", variant: "warning" }) %> | ||
<%= pb_rails("pill", props: { text: "hidden", variant: "warning" }) %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= pb_rails("background", props: { id: "code-wrapper", classname: "border-bottom", background_color: "dark", padding: "none" }) do %> | ||
<%= pb_rails("caption", props: { text: "EXAMPLE IN USE", padding_top: "lg", margin_x: "xl", classname: "dark" }) %> | ||
<div class="pb--codeCopy"> | ||
<pre class="highlight pt_sm" style="margin: 0px"><%= raw rouge(@display_in_use_code_example, "react") %></pre> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<%= render "pages/visual_guidelines_partials/display_breakpoints"%> |
51 changes: 51 additions & 0 deletions
51
playbook-website/app/views/pages/visual_guidelines_partials/_display_breakpoints.html.erb
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,51 @@ | ||
<%= pb_rails("title", props: { text: "Utility Classes", tag: "h3", size: 4, margin_bottom: "xs", padding_top: "xs" }) %> | ||
<%= pb_rails("body", props: { text: "Just want the raw classes? We got you. All of our global props are simple CSS utilities available through classes.", margin_bottom: "sm" }) %> | ||
<%= pb_rails("caption", props: { text: "Visual Guide", margin_bottom: "sm" }) %> | ||
<%= pb_rails("card", props: { | ||
margin_bottom: "none", | ||
padding: "none", | ||
shadow: "deep" | ||
}) do %> | ||
<%= pb_rails("table", props: { size: "sm" }) do %> | ||
<thead> | ||
<tr> | ||
<th>Screen Size</th> | ||
<th>@media screen</th> | ||
<th>Class</th> | ||
<th>Properties</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>xs</td> | ||
<td>@media screen and (max-width: 575px)</td> | ||
<td>.display_xs_hidden</td> | ||
<td>display: hidden !important</td> | ||
</tr> | ||
<tr> | ||
<td>sm</td> | ||
<td>@media screen and (max-width: 576px)</td> | ||
<td>.display_sm_block</td> | ||
<td>display: block !important</td> | ||
</tr> | ||
<tr> | ||
<td>md</td> | ||
<td>@media screen and (max-width: 768px)</td> | ||
<td>.display_md_inline_block</td> | ||
<td>display: inline-block !important</td> | ||
</tr> | ||
<tr> | ||
<td>lg</td> | ||
<td>@media screen and (max-width: 992px)</td> | ||
<td>.display_lg_inline</td> | ||
<td>display: inline !important</td> | ||
</tr> | ||
<tr> | ||
<td>xl</td> | ||
<td>@media screen and (max-width: 1200px)</td> | ||
<td>.display_xl_flex</td> | ||
<td>display: flex !important</td> | ||
</tr> | ||
</tbody> | ||
<% end %> | ||
<% end %> |
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,13 @@ | ||
$display_inline: inline; | ||
$display_block: block; | ||
$display_inline_block: inline-block; | ||
$display_flex: flex; | ||
$display_none: none; | ||
$display_inline_flex: inline-flex; | ||
$displays: ( | ||
display_none: $display_none, | ||
display_flex: $display_flex, | ||
display_inline: $display_inline, | ||
display_inline_block: $display_inline_block, | ||
display_block: $display_block | ||
); |
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,8 @@ | ||
// Simple base types | ||
import { SyntheticEvent } from "react" | ||
|
||
export type Binary = 0 | 1 | ||
export type Callback<T, K> = (arg: T) => K | ||
export type EmptyObject = Record<string, unknown> | ||
export type InputCallback<T> = Callback<SyntheticEvent<T>, void> | ||
export type Noop = () => void |
5 changes: 0 additions & 5 deletions
5
playbook/app/pb_kits/playbook/types.ts → ...book/app/pb_kits/playbook/types/colors.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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
import { SyntheticEvent } from "react" | ||
|
||
export type Callback<T, K> = (arg: T) => K | ||
export type InputCallback<T> = Callback<SyntheticEvent<T>, void> | ||
|
||
export type BackgroundColors = "white" | "dark" | "light" | ||
export type CategoryColors = "category_1" | "category_2" | "category_3" | "category_4" | "category_5" | "category_6" | "category_7" | "category_8" | "category_9" | "category_10" | "category_11" | "category_12" | "category_13" | "category_14" | "category_15" | "category_16" | "category_17" | "category_18" | "category_19" | "category_20" | "category_21" | ||
export type ProductColors = "windows" | "siding" | "doors" | "solar" | "roofing" | "gutters" | "insulation" |
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 @@ | ||
export type DisplayType = "none" | "flex" | "inline_flex" | "inline" | "inline_block" | "block" | ||
|
||
export type Display = { | ||
display?: DisplayType, | ||
} | DisplaySizes | ||
|
||
export type DisplaySizes = {[key: string]: DisplayType | any} | ||
|
||
export type None = "none" |
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,4 @@ | ||
export * from './base' | ||
export * from './colors' | ||
export * from './display' | ||
export * from './sizes' |
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 type Sizes = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" |
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.