Skip to content

Commit

Permalink
Feature: [HOP-38, HOP-45, HOP-44] (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicky-comeau authored Oct 30, 2023
1 parent 5026ef0 commit 3d15b06
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 8 deletions.
3 changes: 2 additions & 1 deletion apps/docs/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"globals": {
"Card": true,
"Table": true,
"Tabs": true
"Tabs": true,
"TableSection": true
}
}
29 changes: 29 additions & 0 deletions apps/docs/components/tableSection/TableSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";
import Table from "@/components/ui/table/Table";

import "@hopper-ui/tokens/fonts.css";

interface TokenProps {
name: string;
value: string;
}
interface TableSectionProps {
tokens: TokenProps[];
categories: string[];
excludedCategories?: string[];
categoryKey: string;
}

const TableSection = ({ tokens, categories, excludedCategories, categoryKey }: TableSectionProps) => {
const categoryTokens = tokens.filter(token => {
const excludedCategoryTokens = excludedCategories?.some(category => token.name.includes(category));

return categories.some(category => token.name.includes(category)) && !excludedCategoryTokens;
});

return <div className="hd-table-section">
<Table category={categoryKey} data={categoryTokens} />
</div>;
};

export default TableSection;
2 changes: 2 additions & 0 deletions apps/docs/components/ui/mdx/Mdx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Pre from "@/components/ui/pre/Pre";
import Title from "@/components/ui/title/Title";
import Table from "@/components/ui/table/Table";
import Tabs from "@/components/tabs/Tabs";
import TableSection from "@/components/tableSection/TableSection";

type HeadingProps = React.DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;

Expand All @@ -16,6 +17,7 @@ const components = {
pre: Pre,
Table: Table,
Tabs: Tabs,
TableSection: TableSection,
h1: (props: HeadingProps) => {
return <Title {...props} as="h1" />;
},
Expand Down
44 changes: 43 additions & 1 deletion apps/docs/content/tokens/semantic/dimensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,46 @@ import tokens from '../../../datas/tokens.json';

export const categoryKey = "size";

<Table category={categoryKey} data={tokens.semantic[categoryKey]} />
## Padding

### Inset

Inset space refers to the space within a block or container from which elements are separated from the edge. By default, the inset is equal on all four sides. Inset is also known as padding.

<TableSection categoryKey={categoryKey} tokens={tokens.semantic[categoryKey]} categories={
["inset"]
} excludedCategories={["inset-squish", "inset-stretch"]} />

### Inset Squish

Squish inset reduces the top and bottom padding by one space increment relative to the default inset space.

<TableSection categoryKey={categoryKey} tokens={tokens.semantic[categoryKey]} categories={
["inset-squish"]
} />

### Inset Stretch

Stretch inset increases the top and bottom padding by one space increment relative to the default inset space.

<TableSection categoryKey={categoryKey} tokens={tokens.semantic[categoryKey]} categories={
["inset-stretch"]
} />

## Margin

### Stack

Stack is the space that separates elements or containers arranged vertically within a column. The last element of the stack should omit this space.

<TableSection categoryKey={categoryKey} tokens={tokens.semantic[categoryKey]} categories={
["stack"]
} />

### Inline

Inline refers to the space that separates inline elements arranged horizontally and that may wrap on the right. The last element should omit this space.

<TableSection categoryKey={categoryKey} tokens={tokens.semantic[categoryKey]} categories={
["inline"]
} />
4 changes: 2 additions & 2 deletions apps/docs/datas/tokens-dark.json
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@
},
{
"name": "hop-upsell-surface-hover",
"value": "#7e5e0a"
"value": "#eac96d"
},
{
"name": "hop-upsell-border-disabled",
Expand Down Expand Up @@ -1077,7 +1077,7 @@
},
{
"name": "hop-decorative-option8-surface",
"value": "#ffbcb7"
"value": "#ffd6d3"
},
{
"name": "hop-decorative-option8-text",
Expand Down
6 changes: 5 additions & 1 deletion apps/docs/datas/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@
},
{
"name": "hop-decorative-option8-surface",
"value": "#ffbcb7"
"value": "#ffd6d3"
},
{
"name": "hop-decorative-option8-text",
Expand Down Expand Up @@ -1395,6 +1395,10 @@
"name": "hop-neutral-border-disabled",
"value": "#ecebe8"
},
{
"name": "hop-neutral-border-strong-hover",
"value": "#505050"
},
{
"name": "hop-neutral-border-strong",
"value": "#3c3c3c"
Expand Down
4 changes: 2 additions & 2 deletions packages/tokens/src/tokens/semantic/dark/colors.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"surface-hover": {
"$type": "color",
"$value": "{sunken-treasure.600}"
"$value": "{sunken-treasure.100}"
},
"border-disabled": {
"$type": "color",
Expand Down Expand Up @@ -327,7 +327,7 @@
},
"surface": {
"$type": "color",
"$value": "{amanita.100}"
"$value": "{amanita.75}"
},
"text": {
"$type": "color",
Expand Down
6 changes: 5 additions & 1 deletion packages/tokens/src/tokens/semantic/light/colors.tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
},
"surface": {
"$type": "color",
"$value": "{amanita.100}"
"$value": "{amanita.75}"
},
"text": {
"$type": "color",
Expand Down Expand Up @@ -662,6 +662,10 @@
"$type": "color",
"$value": "{rock.50}"
},
"border-strong-hover": {
"$type": "color",
"$value": "{rock.700}"
},
"border-strong": {
"$type": "color",
"$value": "{rock.800}"
Expand Down

0 comments on commit 3d15b06

Please sign in to comment.