Skip to content

Commit

Permalink
feat(Text): add extraLarge size
Browse files Browse the repository at this point in the history
  • Loading branch information
mainframev committed Jun 15, 2023
1 parent 2943557 commit afe2971
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/src/__examples__/Text/DEFAULT.tsx
Expand Up @@ -27,7 +27,7 @@ export default {
{
name: "size",
type: "select",
options: ["small", "normal", "large"],
options: ["small", "normal", "large", "extraLarge"],
defaultValue: "normal",
},
{
Expand Down
4 changes: 4 additions & 0 deletions docs/src/__examples__/Text/SIZES.tsx
Expand Up @@ -16,5 +16,9 @@ export default {
name: "Large",
code: `() => <Text size="large">Large text</Text>`,
},
{
name: "ExtraLarge",
code: `() => <Text size="extraLarge">Large text</Text>`,
},
],
};
18 changes: 9 additions & 9 deletions packages/orbit-components/src/Text/README.md
Expand Up @@ -34,12 +34,12 @@ Table below contains all types of the props available in the Text component.

### enum

| type | align | as | size | weight |
| :------------ | :---------- | :------- | :--------- | :--------- |
| `"primary"` | `"start"` | `"p"` | `"small"` | `"normal"` |
| `"secondary"` | `"end"` | `"span"` | `"normal"` | `"medium"` |
| `"info"` | `"left"` | `"div"` | `"large"` | `"bold"` |
| `"success"` | `"center"` | | | |
| `"warning"` | `"right"` | | | |
| `"critical"` | `"justify"` | | | |
| `"white"` | | | | |
| type | align | as | size | weight |
| :------------ | :---------- | :------- | :------------- | :--------- |
| `"primary"` | `"start"` | `"p"` | `"small"` | `"normal"` |
| `"secondary"` | `"end"` | `"span"` | `"normal"` | `"medium"` |
| `"info"` | `"left"` | `"div"` | `"large"` | `"bold"` |
| `"success"` | `"center"` | | `"extraLarge"` | |
| `"warning"` | `"right"` | | | |
| `"critical"` | `"justify"` | | | |
| `"white"` | | | | |
1 change: 1 addition & 0 deletions packages/orbit-components/src/Text/consts.ts
Expand Up @@ -12,6 +12,7 @@ export enum SIZE_OPTIONS {
SMALL = "small",
NORMAL = "normal",
LARGE = "large",
EXTRA_LARGE = "extraLarge",
}

export enum WEIGHT_OPTIONS {
Expand Down
2 changes: 1 addition & 1 deletion packages/orbit-components/src/Text/index.js.flow
Expand Up @@ -11,7 +11,7 @@ import type { Globals, ObjectProperty } from "../common/common.js.flow";
type Align = "start" | "end" | "left" | "center" | "right" | "justify";
type As = "p" | "span" | "div";
type Type = "primary" | "secondary" | "info" | "success" | "warning" | "critical" | "white";
type Size = "large" | "normal" | "small";
type Size = "large" | "normal" | "small" | "extraLarge";
type Weight = "normal" | "medium" | "bold";

export type Props = {|
Expand Down
2 changes: 2 additions & 0 deletions packages/orbit-components/src/Text/index.tsx
Expand Up @@ -47,6 +47,7 @@ const getWeightToken = ({ theme, weight }: { theme: Theme; weight: Weight }): st

const getSizeToken = ({ theme, size }: { theme: Theme; size: Common.Size }): string | null => {
const sizeTokens = {
[SIZE_OPTIONS.EXTRA_LARGE]: theme.orbit.fontSizeTextExtraLarge,
[SIZE_OPTIONS.LARGE]: theme.orbit.fontSizeTextLarge,
[SIZE_OPTIONS.NORMAL]: theme.orbit.fontSizeTextNormal,
[SIZE_OPTIONS.SMALL]: theme.orbit.fontSizeTextSmall,
Expand All @@ -65,6 +66,7 @@ const getLineHeightToken = ({
size?: Common.Size | null;
}): string | null => {
const lineHeightTokens = {
[SIZE_OPTIONS.EXTRA_LARGE]: theme.orbit.lineHeightTextLarge,
[SIZE_OPTIONS.LARGE]: theme.orbit.lineHeightTextLarge,
[SIZE_OPTIONS.NORMAL]: theme.orbit.lineHeightTextNormal,
[SIZE_OPTIONS.SMALL]: theme.orbit.lineHeightTextSmall,
Expand Down

0 comments on commit afe2971

Please sign in to comment.