@sats-group/fresh-fitness-ui-lib 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/README.md +15 -0
- package/catalog-info.yaml +12 -0
- package/eslint.config.mjs +94 -0
- package/fonts/moderat-bold.woff +0 -0
- package/fonts/moderat-bold.woff2 +0 -0
- package/fonts/moderat-medium.woff +0 -0
- package/fonts/moderat-medium.woff2 +0 -0
- package/fonts/moderat-regular-italic.woff +0 -0
- package/fonts/moderat-regular-italic.woff2 +0 -0
- package/fonts/moderat-regular.woff +0 -0
- package/fonts/moderat-regular.woff2 +0 -0
- package/fonts/tasty.woff +0 -0
- package/fonts/tasty.woff2 +0 -0
- package/package.json +48 -0
- package/react/text/index.ts +2 -0
- package/react/text/text.scss +125 -0
- package/react/text/text.tsx +38 -0
- package/react/text/text.types.ts +33 -0
- package/tokens/font-families.scss +8 -0
- package/tokens/fonts.scss +51 -0
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v20
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 📚 Fresh Fitness Web UI Library
|
|
2
|
+
|
|
3
|
+
This repo is the home of reusable Fresh Fitness themed components and tokens, implemented using several parts of [Fresh Fitness Design System](https://www.figma.com/design/WzKCwRY09zn4rzRVfY0YvdRt/sats-ds-styles?node-id=8186-9166&p=f&t=cOToXVmTklZJs8jE-0)
|
|
4
|
+
|
|
5
|
+
## 🍽 Consuming the Library
|
|
6
|
+
|
|
7
|
+
Installing the library as a dependency would in this case be done using
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save @sats-group/fresh-fitness-ui-lib
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### 👷♀️ Making This Library
|
|
14
|
+
|
|
15
|
+
- [Contribute](docs/contributing.md)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
apiVersion: backstage.io/v1alpha1
|
|
2
|
+
kind: Component
|
|
3
|
+
metadata:
|
|
4
|
+
name: fresh-fitness-ui-lib
|
|
5
|
+
title: Fresh Fitness UI Library
|
|
6
|
+
links:
|
|
7
|
+
- url: https://ui-lib.freshfitness.no/
|
|
8
|
+
title: Website
|
|
9
|
+
spec:
|
|
10
|
+
type: library
|
|
11
|
+
lifecycle: production
|
|
12
|
+
owner: self-service-team
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
2
|
+
import js from '@eslint/js';
|
|
3
|
+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import tsParser from '@typescript-eslint/parser';
|
|
5
|
+
import prettier from 'eslint-plugin-prettier';
|
|
6
|
+
import react from 'eslint-plugin-react';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
const compat = new FlatCompat({
|
|
13
|
+
baseDirectory: __dirname,
|
|
14
|
+
recommendedConfig: js.configs.recommended,
|
|
15
|
+
allConfig: js.configs.all,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export default [
|
|
19
|
+
{
|
|
20
|
+
ignores: [
|
|
21
|
+
'**/.vscode',
|
|
22
|
+
'**/site/build',
|
|
23
|
+
'**/dist',
|
|
24
|
+
'**/docs',
|
|
25
|
+
'**/node_modules',
|
|
26
|
+
'**/test-results',
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
...compat.extends(
|
|
30
|
+
'eslint:recommended',
|
|
31
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
32
|
+
'plugin:@typescript-eslint/recommended',
|
|
33
|
+
'prettier',
|
|
34
|
+
),
|
|
35
|
+
{
|
|
36
|
+
plugins: {
|
|
37
|
+
'@typescript-eslint': typescriptEslint,
|
|
38
|
+
prettier,
|
|
39
|
+
react,
|
|
40
|
+
},
|
|
41
|
+
languageOptions: {
|
|
42
|
+
globals: {},
|
|
43
|
+
parser: tsParser,
|
|
44
|
+
},
|
|
45
|
+
settings: {
|
|
46
|
+
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
|
|
47
|
+
react: {
|
|
48
|
+
version: '20',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
rules: {
|
|
52
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
53
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
54
|
+
'@typescript-eslint/ban-types': 'off',
|
|
55
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
56
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
57
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
58
|
+
'@typescript-eslint/no-redeclare': 'error',
|
|
59
|
+
'@typescript-eslint/no-unused-vars': [
|
|
60
|
+
'warn',
|
|
61
|
+
{
|
|
62
|
+
vars: 'all',
|
|
63
|
+
args: 'after-used',
|
|
64
|
+
argsIgnorePattern: '(^_|^next$)',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
|
68
|
+
'arrow-parens': ['warn', 'as-needed'],
|
|
69
|
+
eqeqeq: 'error',
|
|
70
|
+
'no-console': 'warn',
|
|
71
|
+
'no-dupe-args': 'error',
|
|
72
|
+
'no-dupe-keys': 'error',
|
|
73
|
+
'no-irregular-whitespace': 'warn',
|
|
74
|
+
'no-unreachable': 'error',
|
|
75
|
+
'no-use-before-define': 'off',
|
|
76
|
+
'no-warning-comments': 'warn',
|
|
77
|
+
'prettier/prettier': [
|
|
78
|
+
'warn',
|
|
79
|
+
{
|
|
80
|
+
endOfLine: 'auto',
|
|
81
|
+
singleQuote: true,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
semi: 'error',
|
|
85
|
+
strict: 'off',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
files: ['**/*.js', '**/*.ts'],
|
|
90
|
+
rules: {
|
|
91
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
];
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/fonts/tasty.woff
ADDED
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sats-group/fresh-fitness-ui-lib",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Fresh Fitness user interface library",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "run-s clean typecheck",
|
|
8
|
+
"clean": "node rimraf.mjs",
|
|
9
|
+
"dev": "npm run dev --workspace=site",
|
|
10
|
+
"lint": "eslint",
|
|
11
|
+
"lint:ci": "eslint --max-warnings 0",
|
|
12
|
+
"typecheck": "tsc --noEmit"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://sats-group@dev.azure.com/sats-group/Fresh%20Web/_git/ui-lib"
|
|
17
|
+
},
|
|
18
|
+
"author": "SATS",
|
|
19
|
+
"license": "UNLICENSED",
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "^22.13.1",
|
|
22
|
+
"@types/react": "^19.0.8",
|
|
23
|
+
"@types/react-dom": "^19.0.3",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
25
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
26
|
+
"eslint": "^9.20.1",
|
|
27
|
+
"eslint-config-prettier": "^10.0.1",
|
|
28
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
29
|
+
"eslint-plugin-react": "^7.37.4",
|
|
30
|
+
"globby": "^14.1.0",
|
|
31
|
+
"npm-run-all": "^4.1.5",
|
|
32
|
+
"prettier": "^3.5.0",
|
|
33
|
+
"react": "^19.0.0",
|
|
34
|
+
"react-dom": "^19.0.0",
|
|
35
|
+
"rimraf": "^6.0.1",
|
|
36
|
+
"sass-embedded": "^1.83.4",
|
|
37
|
+
"tslib": "^2.8.1",
|
|
38
|
+
"typescript": "^5.7.3"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"classnames": "^2.5.1",
|
|
42
|
+
"react": "^19.0.0",
|
|
43
|
+
"react-dom": "^19.0.0"
|
|
44
|
+
},
|
|
45
|
+
"workspaces": [
|
|
46
|
+
"site"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@use '../../tokens/fonts';
|
|
2
|
+
@use '../../tokens/font-families';
|
|
3
|
+
|
|
4
|
+
.text {
|
|
5
|
+
&--tight {
|
|
6
|
+
@supports (text-box-edge: cap) and (text-box-trim: both) {
|
|
7
|
+
// NOTE: These properties are not widely supported yet
|
|
8
|
+
text-box-edge: cap;
|
|
9
|
+
text-box-trim: both;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@supports (not (text-box-edge: cap)) and (not (text-box-trim: both)) {
|
|
13
|
+
line-height: 0.95 !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&--variant {
|
|
18
|
+
&-content {
|
|
19
|
+
font-family: font-families.$content, font-families.$content-fallback;
|
|
20
|
+
line-height: 1.5;
|
|
21
|
+
|
|
22
|
+
&.text--size-header1 {
|
|
23
|
+
font-size: clamp(26px, 4vw, 36px);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.text--size-header2 {
|
|
27
|
+
font-size: clamp(22px, 4vw, 28px);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.text--size-header3 {
|
|
31
|
+
font-size: clamp(19px, 4vw, 24px);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&.text--size-large {
|
|
35
|
+
font-size: clamp(16px, 3vw, 20px);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.text--size-basic {
|
|
39
|
+
font-size: clamp(14px, 3vw, 16px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.text--size-small {
|
|
43
|
+
font-size: clamp(12px, 3vw, 14px);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.text--size-interface {
|
|
47
|
+
font-size: clamp(10px, 3vw, 12px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&.text--theme-emphasis {
|
|
51
|
+
font-weight: 700;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&.text--theme-italic {
|
|
55
|
+
font-weight: 400;
|
|
56
|
+
font-style: italic;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&.text--theme-medium {
|
|
60
|
+
font-weight: 500;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.text--theme-normal {
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&-contrast {
|
|
69
|
+
font-family: font-families.$contrast, font-families.$contrast-fallback;
|
|
70
|
+
line-height: 1.2;
|
|
71
|
+
|
|
72
|
+
&.text--size-header1 {
|
|
73
|
+
font-size: clamp(26px, 4vw, 36px);
|
|
74
|
+
font-weight: 400;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.text--size-header2 {
|
|
78
|
+
font-size: clamp(22px, 4vw, 28px);
|
|
79
|
+
font-weight: 400;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.text--size-header3 {
|
|
83
|
+
font-size: clamp(19px, 4vw, 24px);
|
|
84
|
+
font-weight: 400;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&-hero {
|
|
89
|
+
font-family: font-families.$hero, font-families.$hero-fallback;
|
|
90
|
+
letter-spacing: 0.02em;
|
|
91
|
+
line-height: 1.3;
|
|
92
|
+
text-transform: uppercase;
|
|
93
|
+
|
|
94
|
+
&.text--size-header1 {
|
|
95
|
+
font-size: clamp(36px, 7vw, 64px);
|
|
96
|
+
font-weight: 900;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.text--size-header2 {
|
|
100
|
+
font-size: clamp(24px, 4vw, 38px);
|
|
101
|
+
font-weight: 800;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.text--size-header3 {
|
|
105
|
+
font-size: clamp(19px, 4vw, 30px);
|
|
106
|
+
font-weight: 700;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&.text--size-large {
|
|
110
|
+
font-size: clamp(16px, 3vw, 20px);
|
|
111
|
+
font-weight: 600;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&.text--size-basic {
|
|
115
|
+
font-size: clamp(14px, 3vw, 16px);
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&.text--size-small {
|
|
120
|
+
font-size: clamp(12px, 3vw, 14px);
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { Text as Props } from './text.types';
|
|
5
|
+
import { sizes, themes, variants } from './text.types';
|
|
6
|
+
|
|
7
|
+
const Text: React.FunctionComponent<React.PropsWithChildren<Props>> & {
|
|
8
|
+
sizes: typeof sizes;
|
|
9
|
+
themes: typeof themes;
|
|
10
|
+
variants: typeof variants;
|
|
11
|
+
} = ({
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
elementName = 'span',
|
|
15
|
+
size = sizes.basic,
|
|
16
|
+
theme = themes.normal,
|
|
17
|
+
tight,
|
|
18
|
+
variant = variants.content,
|
|
19
|
+
}) =>
|
|
20
|
+
React.createElement(
|
|
21
|
+
elementName,
|
|
22
|
+
{
|
|
23
|
+
className: cn('text', {
|
|
24
|
+
[`text--size-${size}`]: size,
|
|
25
|
+
[`text--theme-${theme}`]: theme,
|
|
26
|
+
'text--tight': tight,
|
|
27
|
+
[`text--variant-${variant}`]: variant,
|
|
28
|
+
[`${className}`]: className,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
children,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
Text.sizes = sizes;
|
|
35
|
+
Text.themes = themes;
|
|
36
|
+
Text.variants = variants;
|
|
37
|
+
|
|
38
|
+
export default Text;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ValueOf } from 'type-fest';
|
|
2
|
+
|
|
3
|
+
export const sizes = {
|
|
4
|
+
header1: 'header1',
|
|
5
|
+
header2: 'header2',
|
|
6
|
+
header3: 'header3',
|
|
7
|
+
large: 'large',
|
|
8
|
+
basic: 'basic',
|
|
9
|
+
small: 'small',
|
|
10
|
+
interface: 'interface',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export const themes = {
|
|
14
|
+
emphasis: 'emphasis',
|
|
15
|
+
italic: 'italic',
|
|
16
|
+
medium: 'medium',
|
|
17
|
+
normal: 'normal',
|
|
18
|
+
} as const;
|
|
19
|
+
|
|
20
|
+
export const variants = {
|
|
21
|
+
content: 'content',
|
|
22
|
+
contrast: 'contrast',
|
|
23
|
+
hero: 'hero',
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
export type Text = {
|
|
27
|
+
className?: string;
|
|
28
|
+
elementName?: string;
|
|
29
|
+
size?: ValueOf<typeof sizes>;
|
|
30
|
+
theme?: ValueOf<typeof themes>;
|
|
31
|
+
tight?: boolean;
|
|
32
|
+
variant?: ValueOf<typeof variants>;
|
|
33
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@use './font-families';
|
|
2
|
+
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: font-families.$content;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
font-weight: 400;
|
|
7
|
+
font-display: swap;
|
|
8
|
+
src:
|
|
9
|
+
url('../fonts/moderat-regular.woff2') format('woff2'),
|
|
10
|
+
url('../fonts/moderat-regular.woff') format('woff');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@font-face {
|
|
14
|
+
font-family: font-families.$content;
|
|
15
|
+
font-style: italic;
|
|
16
|
+
font-weight: 400;
|
|
17
|
+
font-display: swap;
|
|
18
|
+
src:
|
|
19
|
+
url('../fonts/moderat-regular-italic.woff2') format('woff2'),
|
|
20
|
+
url('../fonts/moderat-regular-italic.woff') format('woff');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@font-face {
|
|
24
|
+
font-family: font-families.$content;
|
|
25
|
+
font-style: normal;
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
font-display: swap;
|
|
28
|
+
src:
|
|
29
|
+
url('../fonts/moderat-medium.woff2') format('woff2'),
|
|
30
|
+
url('../fonts/moderat-medium.woff') format('woff');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@font-face {
|
|
34
|
+
font-family: font-families.$content;
|
|
35
|
+
font-style: normal;
|
|
36
|
+
font-weight: 700;
|
|
37
|
+
font-display: swap;
|
|
38
|
+
src:
|
|
39
|
+
url('../fonts/moderat-bold.woff2') format('woff2'),
|
|
40
|
+
url('../fonts/moderat-bold.woff') format('woff');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@font-face {
|
|
44
|
+
font-family: font-families.$contrast;
|
|
45
|
+
font-style: normal;
|
|
46
|
+
font-weight: 400;
|
|
47
|
+
font-display: swap;
|
|
48
|
+
src:
|
|
49
|
+
url('../fonts/tasty.woff2') format('woff2'),
|
|
50
|
+
url('../fonts/tasty.woff') format('woff');
|
|
51
|
+
}
|