@pluralsight/headless-styles
Advanced tools
Comparing version 0.0.0-alpha-45edbf to 0.0.0-alpha-51a837
import { getDefaultOptions } from './shared'; | ||
import styles from './buttonCSS.module.css'; | ||
export function getButtonProps(options) { | ||
const { kind, size } = getDefaultOptions(options); | ||
var _a; | ||
const { kind, size, tech } = getDefaultOptions(options); | ||
const formattedSize = `size-${size}`; | ||
const framework = (_a = styles[tech]) !== null && _a !== void 0 ? _a : ''; | ||
return { | ||
className: `ps-btn ${styles.base} ${styles[kind]} ${styles[formattedSize]}`, | ||
className: `ps-btn ${styles.base} ${styles[kind]} ${styles[formattedSize]} ${framework}`, | ||
type: 'button', | ||
}; | ||
} |
@@ -18,6 +18,9 @@ import type { ButtonOptions, ButtonType } from './types'; | ||
appearance: string; | ||
border: string; | ||
borderRadius: string; | ||
border: string; | ||
cursor: string; | ||
fontFamily: string; | ||
fontWeight: string; | ||
height: string; | ||
outlineOffset: string; | ||
textAlign: string; | ||
@@ -48,6 +51,9 @@ textDecoration: string; | ||
appearance: string; | ||
border: string; | ||
borderRadius: string; | ||
border: string; | ||
cursor: string; | ||
fontFamily: string; | ||
fontWeight: string; | ||
height: string; | ||
outlineOffset: string; | ||
textAlign: string; | ||
@@ -54,0 +60,0 @@ textDecoration: string; |
import { psBackground, psBackgroundActive, psBackgroundHover, psBackgroundWeak, psNeutralBackground, psNeutralBackgroundActive, psNeutralBackgroundHover, psNeutralText, psNeutralTextWeak, psText, psTextMedium, } from '@pluralsight/design-tokens'; | ||
import { getDefaultOptions } from './shared'; | ||
const BASE_FONT_SIZE = '16px'; | ||
const baseStyles = { | ||
js: { | ||
appearance: 'none', | ||
borderRadius: '6px', | ||
backgroundColor: 'transparent', | ||
border: 'none', | ||
borderRadius: '6px', | ||
cursor: 'pointer', | ||
fontFamily: 'PS TT Commons Roman, Gotham SSm A, Gotham SSm B, Arial,sans-serif', | ||
fontSize: '16px', | ||
fontSize: BASE_FONT_SIZE, | ||
fontWeight: 'inherit', | ||
height: 'initial', | ||
outlineOffset: 'initial', | ||
padding: '10px 16px', | ||
@@ -36,2 +40,5 @@ textAlign: 'center', | ||
sans-serif; | ||
font-weight: inherit; | ||
height: initial; | ||
outline-offset: initial; | ||
text-align: center; | ||
@@ -72,3 +79,3 @@ text-decoration: none; | ||
js: { | ||
backgroundColor: psNeutralBackground, | ||
backgroundColor: `${psNeutralBackground}`, | ||
color: psNeutralText, | ||
@@ -84,3 +91,3 @@ }, | ||
js: { | ||
backgroundColor: psBackground, | ||
backgroundColor: `${psBackground}`, | ||
color: '#fff', | ||
@@ -96,3 +103,3 @@ }, | ||
js: { | ||
backgroundColor: psBackgroundWeak, | ||
backgroundColor: `${psBackgroundWeak}`, | ||
color: psText, | ||
@@ -143,3 +150,3 @@ }, | ||
js: { | ||
fontSize: '16px', | ||
fontSize: BASE_FONT_SIZE, | ||
padding: '14.5px 24px', | ||
@@ -155,3 +162,3 @@ }, | ||
js: { | ||
fontSize: '16px', | ||
fontSize: BASE_FONT_SIZE, | ||
padding: '10px 16px', | ||
@@ -174,3 +181,3 @@ }, | ||
&:active { | ||
background-color: ${psBackgroundActive} !important; | ||
background-color: ${psBackgroundActive}; | ||
} | ||
@@ -184,3 +191,3 @@ `, | ||
active: { | ||
backgroundColor: `${psBackgroundActive} !important`, | ||
backgroundColor: `${psBackgroundActive}`, | ||
}, | ||
@@ -197,3 +204,3 @@ }, | ||
&:active { | ||
background-color: ${psNeutralBackgroundActive} !important; | ||
background-color: ${psNeutralBackgroundActive}; | ||
} | ||
@@ -207,3 +214,3 @@ `, | ||
active: { | ||
backgroundColor: `${psNeutralBackgroundActive} !important`, | ||
backgroundColor: `${psNeutralBackgroundActive}`, | ||
}, | ||
@@ -220,3 +227,3 @@ }, | ||
&:active { | ||
background-color: ${psBackgroundActive} !important; | ||
background-color: ${psBackgroundActive}; | ||
} | ||
@@ -230,3 +237,3 @@ `, | ||
active: { | ||
backgroundColor: `${psBackgroundActive} !important`, | ||
backgroundColor: `${psBackgroundActive}`, | ||
}, | ||
@@ -233,0 +240,0 @@ }, |
@@ -1,5 +0,6 @@ | ||
import type { ButtonOptions, Kind, Size } from './types'; | ||
import type { ButtonOptions, Kind, Size, Tech } from './types'; | ||
export declare const defaultButtonOptions: { | ||
kind: Kind; | ||
size: Size; | ||
tech: Tech; | ||
}; | ||
@@ -9,2 +10,3 @@ export declare function getDefaultOptions(options?: ButtonOptions): { | ||
size: Size; | ||
tech: Tech; | ||
}; |
export const defaultButtonOptions = { | ||
kind: 'text', | ||
size: 'm', | ||
tech: '', | ||
}; | ||
export function getDefaultOptions(options) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
return { | ||
kind: (_a = options === null || options === void 0 ? void 0 : options.kind) !== null && _a !== void 0 ? _a : defaultButtonOptions.kind, | ||
size: (_b = options === null || options === void 0 ? void 0 : options.size) !== null && _b !== void 0 ? _b : defaultButtonOptions.size, | ||
tech: (_c = options === null || options === void 0 ? void 0 : options.tech) !== null && _c !== void 0 ? _c : defaultButtonOptions.tech, | ||
}; | ||
} |
@@ -5,2 +5,3 @@ import { ButtonHTMLAttributes, DetailedHTMLProps } from 'react'; | ||
size?: Size; | ||
tech?: Tech; | ||
} | ||
@@ -10,1 +11,2 @@ export declare type ButtonType = 'button' | 'submit' | 'reset' | undefined; | ||
export declare type Size = 'xs' | 's' | 'm' | 'l'; | ||
export declare type Tech = 'chakra' | ''; |
{ | ||
"name": "@pluralsight/headless-styles", | ||
"version": "0.0.0-alpha-45edbf", | ||
"version": "0.0.0-alpha-51a837", | ||
"description": "Headless styles for Pluralsight.", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16474
510