@bolttech/atoms-section-header 0.14.0 → 0.15.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/README.md
CHANGED
|
@@ -1,8 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SectionHeader Component
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
The **SectionHeader** component is a React component designed to provide a header for sections with an optional icon or background illustration. This component allows you to create visually appealing section headers with customizable titles and decorative elements.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Table of Contents
|
|
6
6
|
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Props](#props)
|
|
10
|
+
- [Example](#example)
|
|
11
|
+
- [Contributing](#contributing)
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
To use the **SectionHeader** component in your React application, you need to follow these steps:
|
|
16
|
+
|
|
17
|
+
### Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @edirect/frontend-foundations @bolttech/atoms-section-header
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add @edirect/frontend-foundations @bolttech/atoms-section-header
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Once you have the required dependencies installed, you can start using the `SectionHeader` component in your React application.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
The **SectionHeader** component provides a visually appealing section header with an optional icon or background illustration. It supports customization through various props.
|
|
34
|
+
|
|
35
|
+
To use the component, import it and include it in your JSX:
|
|
36
|
+
|
|
37
|
+
```jsx
|
|
38
|
+
import React from 'react';
|
|
39
|
+
import {SectionHeader} from '@bolttech/atoms-section-header';
|
|
40
|
+
import {bolttechTheme, BolttechThemeProvider} from "@edirect/frontend-foundations";
|
|
41
|
+
|
|
42
|
+
function App() {
|
|
43
|
+
return (
|
|
44
|
+
<BolttechThemeProvider theme={bolttechTheme}>
|
|
45
|
+
<SectionHeader
|
|
46
|
+
title="Welcome to our Section"
|
|
47
|
+
icon={<YourIconComponent/>}
|
|
48
|
+
background={<YourBackgroundComponent/>}
|
|
49
|
+
dataTestId="section-header-component"
|
|
50
|
+
/>
|
|
51
|
+
</BolttechThemeProvider>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export default App;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Props
|
|
59
|
+
|
|
60
|
+
The **SectionHeader** component accepts the following props:
|
|
61
|
+
|
|
62
|
+
| Prop | Type | Description |
|
|
63
|
+
|--------------|---------------|---------------------------------------------------|
|
|
64
|
+
| `dataTestId` | string | The data-testid attribute for testing purposes. |
|
|
65
|
+
| `title` | string | The title text of the section header. |
|
|
66
|
+
| `icon` | ReactNode | An optional icon component to be displayed. |
|
|
67
|
+
| `background` | ReactNode | An optional background illustration component. |
|
|
68
|
+
|
|
69
|
+
## Example
|
|
70
|
+
|
|
71
|
+
Here's an example of using the **SectionHeader** component:
|
|
72
|
+
|
|
73
|
+
```jsx
|
|
74
|
+
<SectionHeader
|
|
75
|
+
title="Discover Our New Collection"
|
|
76
|
+
icon={<Icon name="bookmark" />}
|
|
77
|
+
background={<Illustration src={illustrationUrl} />}
|
|
78
|
+
dataTestId="section-header-component"
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This will render a **SectionHeader** component with a title, an icon, and a background illustration.
|
|
83
|
+
|
|
84
|
+
## Contributing
|
|
85
|
+
|
|
86
|
+
Contributions to the **SectionHeader** component are welcome. If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on the project's Bitbucket repository.
|
package/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var react = require('react');
|
|
7
8
|
var styled = require('styled-components');
|
|
8
9
|
var frontendFoundations = require('@edirect/frontend-foundations');
|
|
9
10
|
|
|
@@ -42,19 +43,20 @@ const IlustrationContainer = /*#__PURE__*/styled__default["default"].div.withCon
|
|
|
42
43
|
componentId: "sc-xtf6u-4"
|
|
43
44
|
})(["display:flex;position:relative;justify-content:flex-end;align-items:flex-end;@media only screen and (max-width:1431px){width:60%;height:100%;svg{max-width:100%;max-height:100%;height:100%;}}"]);
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
dataTestId = 'section-header-data-testid',
|
|
46
|
+
const SectionHeader = /*#__PURE__*/react.forwardRef(({
|
|
47
|
+
dataTestId: _dataTestId = 'section-header-data-testid',
|
|
47
48
|
title,
|
|
48
49
|
icon,
|
|
49
50
|
background
|
|
50
|
-
}) {
|
|
51
|
+
}, ref) => {
|
|
51
52
|
return jsxRuntime.jsxs(SectionHeaderContainer, {
|
|
52
53
|
fullWidth: true,
|
|
53
|
-
"data-testid":
|
|
54
|
+
"data-testid": _dataTestId,
|
|
55
|
+
ref: ref,
|
|
54
56
|
children: [jsxRuntime.jsx(SectionHeaderLabel, {
|
|
55
57
|
variant: "h1",
|
|
56
58
|
type: "headings",
|
|
57
|
-
"data-testid": `${
|
|
59
|
+
"data-testid": `${_dataTestId}-label`,
|
|
58
60
|
children: title
|
|
59
61
|
}), jsxRuntime.jsxs(IlustrationContainer, {
|
|
60
62
|
children: [icon && jsxRuntime.jsx(Icon, {
|
|
@@ -64,6 +66,6 @@ function SectionHeader({
|
|
|
64
66
|
})]
|
|
65
67
|
})]
|
|
66
68
|
});
|
|
67
|
-
}
|
|
69
|
+
});
|
|
68
70
|
|
|
69
71
|
exports.SectionHeader = SectionHeader;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bolttech/atoms-section-header",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"main": "./index.cjs",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@edirect/frontend-foundations": "0.0.
|
|
8
|
+
"@edirect/frontend-foundations": "0.0.67",
|
|
9
9
|
"react": "18.2.0",
|
|
10
10
|
"styled-components": "5.3.6"
|
|
11
11
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { SectionHeaderProps } from './atoms-section-header.type';
|
|
2
|
-
export declare
|
|
3
|
+
export declare const SectionHeader: React.ForwardRefExoticComponent<SectionHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
3
4
|
export default SectionHeader;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const SectionHeaderContainer: import("styled-components").StyledComponent<(
|
|
3
|
-
export declare const SectionHeaderLabel: import("styled-components").StyledComponent<(
|
|
2
|
+
export declare const SectionHeaderContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@edirect/frontend-foundations/dist/src/shared/types/row.type").RowPropsType & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
3
|
+
export declare const SectionHeaderLabel: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@edirect/frontend-foundations/dist/src/shared/types/typography.type").TypographyPropsType & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
|
|
4
4
|
export declare const Background: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
5
|
export declare const Icon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const IlustrationContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|