@ausbom/page-title 0.2.0 → 0.3.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/lib/PageTitle.d.ts +18 -22
- package/lib/PageTitle.js +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +1 -1
- package/lib/scss/module.scss +66 -98
- package/package.json +2 -2
- package/lib/scss/exports.scss +0 -7
- package/lib/scss/globals.scss +0 -118
package/lib/PageTitle.d.ts
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { IGridItemProps } from '../../grid/lib/Grid'
|
|
3
2
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export type Title = { className?: string, children: string, small?: boolean }
|
|
4
|
+
|
|
5
|
+
export type SubTitle = {
|
|
6
|
+
className?: string
|
|
7
|
+
as?: React.ElementType
|
|
8
|
+
children?: string
|
|
9
|
+
small?: boolean
|
|
10
|
+
}
|
|
11
|
+
export type SubTitleProps<As extends React.ElementType = 'div'> = SubTitle &
|
|
12
|
+
React.ComponentPropsWithoutRef<As>
|
|
13
|
+
|
|
14
|
+
export type MetaData = {
|
|
15
|
+
className?: string
|
|
16
|
+
as?: React.ElementType
|
|
17
|
+
children?: string
|
|
18
|
+
small?: boolean
|
|
7
19
|
}
|
|
20
|
+
export type MetaDataProps<As extends React.ElementType = 'div'> = MetaData &
|
|
21
|
+
React.ComponentPropsWithoutRef<As>
|
|
8
22
|
|
|
9
23
|
export interface IProps {
|
|
10
24
|
/**
|
|
@@ -13,18 +27,6 @@ export interface IProps {
|
|
|
13
27
|
*/
|
|
14
28
|
className?: string
|
|
15
29
|
|
|
16
|
-
/**
|
|
17
|
-
* `theme` is an optional property that defines the color scheme of the component.
|
|
18
|
-
* It can be set to 'white', 'bureau-blue', 'dark-blue', or 'yellow'.
|
|
19
|
-
*/
|
|
20
|
-
theme?: 'white' | 'bureau-blue' | 'dark-blue' | 'yellow'
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* `background` is an optional property that allows setting a background from predefined backgrounds.
|
|
24
|
-
* The type `Background` should be defined elsewhere in the codebase with specifics of what it entails.
|
|
25
|
-
*/
|
|
26
|
-
background?: Background
|
|
27
|
-
|
|
28
30
|
/**
|
|
29
31
|
* `title` is a required string property that specifies the main text or title of the component.
|
|
30
32
|
*/
|
|
@@ -56,12 +58,6 @@ export interface IProps {
|
|
|
56
58
|
* `small` is an optional boolean property that, when true, suggests that the component should use a smaller variant of its styling.
|
|
57
59
|
*/
|
|
58
60
|
small?: boolean
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* `gridLayout` is an optional property that defines responsive layout settings based on screen size breakpoints.
|
|
62
|
-
* The `IGridItemProps` type would typically define how the component's layout should adapt to various screen widths.
|
|
63
|
-
*/
|
|
64
|
-
gridLayout?: IGridItemProps
|
|
65
61
|
}
|
|
66
62
|
|
|
67
63
|
export default class extends React.PureComponent<IProps> {
|
package/lib/PageTitle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=exports.MetaData=exports.SubTitle=exports.Title=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireDefault(require("react"));var _classnames=_interopRequireDefault(require("classnames"));function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=(0,_getPrototypeOf2["default"])(Derived),result;if(hasNativeReflectConstruct){var NewTarget=(0,_getPrototypeOf2["default"])(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else{result=Super.apply(this,arguments)}return(0,_possibleConstructorReturn2["default"])(this,result)}}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(e){return false}}var Title=function Title(_ref){var className=_ref.className,children=_ref.children,small=_ref.small;if(!children)return null;var classes=(0,_classnames["default"])(className,"bom-page-title__title",{"bom-page-title__title--small":small});return/*#__PURE__*/_react["default"].createElement("h1",{className:classes},children)};exports.Title=Title;var SubTitle=function SubTitle(_ref2){var className=_ref2.className,As=_ref2.as,children=_ref2.children,small=_ref2.small;if(!children)return null;var classes=(0,_classnames["default"])(className,"bom-page-title__subtitle",{"bom-page-title__subtitle--small":small});return/*#__PURE__*/_react["default"].createElement(As,{className:classes},children)};exports.SubTitle=SubTitle;var MetaData=function MetaData(_ref3){var className=_ref3.className,As=_ref3.as,children=_ref3.children,small=_ref3.small;if(!children)return null;var classes=(0,_classnames["default"])(className,"bom-page-title__metadata",{"bom-page-title__metadata--small":small});return/*#__PURE__*/_react["default"].createElement(As,{className:classes},children)};exports.MetaData=MetaData;var PageTitle=/*#__PURE__*/function(_React$PureComponent){(0,_inherits2["default"])(PageTitle,_React$PureComponent);var _super=_createSuper(PageTitle);function PageTitle(){(0,_classCallCheck2["default"])(this,PageTitle);return _super.apply(this,arguments)}(0,_createClass2["default"])(PageTitle,[{key:"render",value:function render(){var _ref4=this.props,className=_ref4.className,metaData=_ref4.metaData,metaDataAs=_ref4.metaDataAs,small=_ref4.small,subTitle=_ref4.subTitle,subTitleAs=_ref4.subTitleAs,title=_ref4.title;var classes=(0,_classnames["default"])(className,"bom-page-title",{"bom-page-title--small":small});var MetaDataTag=metaDataAs||PageTitle.defaultProps.metaDataAs||"div";var SubTitleTag=subTitleAs||PageTitle.defaultProps.subTitleAs||"div";return/*#__PURE__*/_react["default"].createElement("div",{className:classes},/*#__PURE__*/_react["default"].createElement(Title,{small:small},title),/*#__PURE__*/_react["default"].createElement(SubTitle,{as:MetaDataTag,small:small},subTitle),/*#__PURE__*/_react["default"].createElement(MetaData,{as:SubTitleTag,small:small},metaData))}}]);return PageTitle}(_react["default"].PureComponent);(0,_defineProperty2["default"])(PageTitle,"defaultProps",{subTitleAs:"div",metaDataAs:"div"});var PageTitleWithRef=/*#__PURE__*/_react["default"].forwardRef(function(props,ref){return/*#__PURE__*/_react["default"].createElement(PageTitle,(0,_extends2["default"])({innerRef:ref},props))});PageTitleWithRef.displayName="PageTitle";var _default=PageTitleWithRef;exports["default"]=_default;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function get(){return _PageTitle["default"]}});Object.defineProperty(exports,"Title",{enumerable:true,get:function get(){return _PageTitle.Title}});Object.defineProperty(exports,"SubTitle",{enumerable:true,get:function get(){return _PageTitle.SubTitle}});Object.defineProperty(exports,"MetaData",{enumerable:true,get:function get(){return _PageTitle.MetaData}});var _PageTitle=_interopRequireWildcard(require("./PageTitle"));
|
package/lib/scss/module.scss
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
@import '../../lib/scss/globals';
|
|
2
1
|
@import '~@ausbom/styles/lib/scss/globals';
|
|
3
2
|
@import '~@ausbom/typography/lib/scss/globals';
|
|
4
3
|
|
|
5
4
|
.bom-page-title {
|
|
6
|
-
|
|
5
|
+
font-family: inherit;
|
|
6
|
+
padding-top: 16px;
|
|
7
|
+
padding-bottom: 16px;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
@include bp(m) {
|
|
10
|
+
padding-top: 32px;
|
|
11
|
+
padding-bottom: 32px;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
margin: 0;
|
|
14
|
+
@include bp(l) {
|
|
15
|
+
padding-top: 40px;
|
|
16
|
+
padding-bottom: 40px;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
&__title + &
|
|
20
|
-
&
|
|
21
|
-
&
|
|
19
|
+
&__title + &__subtitle,
|
|
20
|
+
&__title + &__metadata,
|
|
21
|
+
&__subtitle + &__metadata {
|
|
22
22
|
margin-top: 16px;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
.bom-page-title__title + .bom-page-
|
|
25
|
+
&.bom-page-title--small {
|
|
26
|
+
.bom-page-title__title + .bom-page-title__subtitle {
|
|
27
27
|
margin-top: 12px;
|
|
28
28
|
|
|
29
29
|
@include bp(m) {
|
|
@@ -34,110 +34,78 @@
|
|
|
34
34
|
margin-top: 24px;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
}
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
.bom-page-title__title + .bom-page-title__metadata {
|
|
39
|
+
margin-top: 16px;
|
|
40
|
+
}
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
.bom-page-title__subtitle + .bom-page-title__metadata {
|
|
43
|
+
margin-top: 16px;
|
|
44
|
+
}
|
|
45
45
|
}
|
|
46
|
+
}
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
background-color: map-get($theme-properties, 'bg-color');
|
|
51
|
-
$typo-dark: map-get($theme-properties, 'typo-dark');
|
|
52
|
-
|
|
53
|
-
.bom-page-title {
|
|
54
|
-
&__title {
|
|
55
|
-
@include apply-typography('title', 's', $typo-dark);
|
|
56
|
-
|
|
57
|
-
@include bp(m) {
|
|
58
|
-
@include apply-typography('title', 'm', $typo-dark);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@include bp(l) {
|
|
62
|
-
@include apply-typography('title', 'l', $typo-dark);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
&__sub-title {
|
|
67
|
-
@include apply-typography('subtitle', 's', $typo-dark);
|
|
48
|
+
.bom-page-title__title {
|
|
49
|
+
font-weight: 500;
|
|
50
|
+
margin: 0;
|
|
68
51
|
|
|
69
|
-
|
|
70
|
-
@include apply-typography('subtitle', 'm', $typo-dark);
|
|
71
|
-
}
|
|
52
|
+
@include bom-type-scale($size: 'type-32', $line: 'display');
|
|
72
53
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
54
|
+
@include bp(m) {
|
|
55
|
+
@include bom-type-scale($size: 'type-56', $line: 'display');
|
|
56
|
+
}
|
|
77
57
|
|
|
78
|
-
|
|
79
|
-
|
|
58
|
+
@include bp(l) {
|
|
59
|
+
@include bom-type-scale($size: 'type-64', $line: 'display');
|
|
60
|
+
}
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
62
|
+
&--small {
|
|
63
|
+
@include bom-type-scale($size: 'type-32', $line: 'display');
|
|
84
64
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
}
|
|
65
|
+
@include bp(m) {
|
|
66
|
+
@include bom-type-scale($size: 'type-44', $line: 'display');
|
|
67
|
+
}
|
|
90
68
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
69
|
+
@include bp(l) {
|
|
70
|
+
@include bom-type-scale($size: 'type-56', $line: 'display');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
95
74
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
75
|
+
.bom-page-title__subtitle {
|
|
76
|
+
font-weight: 500;
|
|
99
77
|
|
|
100
|
-
|
|
101
|
-
@include apply-typography('small-title', 'l', $typo-dark);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
78
|
+
@include bom-type-scale($size: 'type-22', $line: 'display');
|
|
104
79
|
|
|
105
|
-
|
|
106
|
-
|
|
80
|
+
@include bp(m) {
|
|
81
|
+
@include bom-type-scale($size: 'type-28', $line: 'display');
|
|
82
|
+
}
|
|
107
83
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
84
|
+
&--small {
|
|
85
|
+
@include bom-type-scale($size: 'type-18', $line: 'display');
|
|
111
86
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
87
|
+
@include bp(m) {
|
|
88
|
+
@include bom-type-scale($size: 'type-22', $line: 'display');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
116
92
|
|
|
117
|
-
|
|
118
|
-
|
|
93
|
+
.bom-page-title__metadata {
|
|
94
|
+
color: get-palette-color('neutral.charcoalMedium');
|
|
119
95
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
96
|
+
.bom-background--theme-white &,
|
|
97
|
+
.bom-background--theme-yellow & {
|
|
98
|
+
color: get-palette-color('neutral.charcoalMedium');
|
|
99
|
+
}
|
|
123
100
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
101
|
+
.bom-background--theme-bureau-blue &,
|
|
102
|
+
.bom-background--theme-dark-blue & {
|
|
103
|
+
color: get-palette-color('neutral.white');
|
|
131
104
|
}
|
|
132
105
|
|
|
133
|
-
|
|
134
|
-
@for $i from 1 through 4 {
|
|
135
|
-
@each $theme, $properties in $theme-map {
|
|
136
|
-
$background-type: if(map-get($properties, 'typo-dark'), 'dark', 'light');
|
|
106
|
+
@include bom-type-scale($size: 'type-16', $line: 'display');
|
|
137
107
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
}
|
|
108
|
+
@include bp(m) {
|
|
109
|
+
@include bom-type-scale($size: 'type-18', $line: 'display');
|
|
142
110
|
}
|
|
143
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ausbom/page-title",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"@ausbom/styles": "^0.13.0",
|
|
42
42
|
"@ausbom/typography": "^0.4.6"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "2ad0211c24f63644659d03bc36b051db14f7322e"
|
|
45
45
|
}
|
package/lib/scss/exports.scss
DELETED
package/lib/scss/globals.scss
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// Typo-map with nested maps for each size
|
|
2
|
-
$typo-map: (
|
|
3
|
-
title: (
|
|
4
|
-
s: (
|
|
5
|
-
style: 'heading-xxl',
|
|
6
|
-
large: false,
|
|
7
|
-
),
|
|
8
|
-
m: (
|
|
9
|
-
style: 'heading-xl',
|
|
10
|
-
large: true,
|
|
11
|
-
),
|
|
12
|
-
l: (
|
|
13
|
-
style: 'heading-xxl',
|
|
14
|
-
large: true,
|
|
15
|
-
),
|
|
16
|
-
),
|
|
17
|
-
small-title: (
|
|
18
|
-
s: (
|
|
19
|
-
style: 'heading-xxl',
|
|
20
|
-
large: false,
|
|
21
|
-
),
|
|
22
|
-
m: (
|
|
23
|
-
style: 'heading-l',
|
|
24
|
-
large: true,
|
|
25
|
-
),
|
|
26
|
-
l: (
|
|
27
|
-
style: 'heading-xl',
|
|
28
|
-
large: true,
|
|
29
|
-
),
|
|
30
|
-
),
|
|
31
|
-
subtitle: (
|
|
32
|
-
s: (
|
|
33
|
-
style: 'heading-s',
|
|
34
|
-
large: true,
|
|
35
|
-
),
|
|
36
|
-
m: (
|
|
37
|
-
style: 'heading-m',
|
|
38
|
-
large: true,
|
|
39
|
-
),
|
|
40
|
-
l: (
|
|
41
|
-
style: 'heading-m',
|
|
42
|
-
large: true,
|
|
43
|
-
),
|
|
44
|
-
),
|
|
45
|
-
small-subtitle: (
|
|
46
|
-
s: (
|
|
47
|
-
style: 'heading-xs',
|
|
48
|
-
large: false,
|
|
49
|
-
),
|
|
50
|
-
m: (
|
|
51
|
-
style: 'heading-m',
|
|
52
|
-
large: false,
|
|
53
|
-
),
|
|
54
|
-
l: (
|
|
55
|
-
style: 'heading-m',
|
|
56
|
-
large: false,
|
|
57
|
-
),
|
|
58
|
-
),
|
|
59
|
-
metadata: (
|
|
60
|
-
s: (
|
|
61
|
-
style: 'body',
|
|
62
|
-
large: false,
|
|
63
|
-
),
|
|
64
|
-
m: (
|
|
65
|
-
style: 'body',
|
|
66
|
-
large: true,
|
|
67
|
-
),
|
|
68
|
-
l: (
|
|
69
|
-
style: 'body',
|
|
70
|
-
large: true,
|
|
71
|
-
),
|
|
72
|
-
),
|
|
73
|
-
small-metadata: (
|
|
74
|
-
s: (
|
|
75
|
-
style: 'body',
|
|
76
|
-
large: false,
|
|
77
|
-
),
|
|
78
|
-
m: (
|
|
79
|
-
style: 'body',
|
|
80
|
-
large: true,
|
|
81
|
-
),
|
|
82
|
-
l: (
|
|
83
|
-
style: 'body',
|
|
84
|
-
large: true,
|
|
85
|
-
),
|
|
86
|
-
),
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
// Theme map without repeating $typo-map
|
|
90
|
-
$theme-map: (
|
|
91
|
-
theme-white: (
|
|
92
|
-
bg-color: get-palette-color('neutral.white'),
|
|
93
|
-
typo-dark: false,
|
|
94
|
-
),
|
|
95
|
-
theme-bureau-blue: (
|
|
96
|
-
bg-color: get-palette-color('secondary.electricBlueDark'),
|
|
97
|
-
typo-dark: true,
|
|
98
|
-
),
|
|
99
|
-
theme-dark-blue: (
|
|
100
|
-
bg-color: get-palette-color('primary.darkBlue'),
|
|
101
|
-
typo-dark: true,
|
|
102
|
-
),
|
|
103
|
-
theme-yellow: (
|
|
104
|
-
bg-color: get-palette-color('secondary.yellow'),
|
|
105
|
-
typo-dark: false,
|
|
106
|
-
),
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
@mixin apply-typography($type, $size, $typo-dark) {
|
|
110
|
-
// Retrieve the nested map for the type
|
|
111
|
-
$type-map: map-get($typo-map, $type);
|
|
112
|
-
|
|
113
|
-
// Now retrieve the style and large values from the nested map
|
|
114
|
-
$typo-style: map-get(map-get($type-map, $size), style);
|
|
115
|
-
$large: map-get(map-get($type-map, $size), large);
|
|
116
|
-
|
|
117
|
-
@include bom-typography($typo-style, $typo-dark, $large);
|
|
118
|
-
}
|