@illinois-toolkit/ilw-hero 0.9.1

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.
@@ -0,0 +1,19 @@
1
+ name: delete_development
2
+ on:
3
+ workflow_dispatch:
4
+ env:
5
+ COMPONENT_NAME: 'ilw-hero' # set this to the web component name you are using
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Configure AWS Credentials
11
+ uses: aws-actions/configure-aws-credentials@v1
12
+ with:
13
+ aws-access-key-id: ${{ vars.TOOLKIT_AWS_ACCESS_KEY }}
14
+ aws-secret-access-key: ${{ secrets.TOOLKIT_AWS_ACCESS_SECRET }}
15
+ aws-region: us-east-2
16
+ - name: Delete S3 bucket
17
+ run: aws s3 rm s3://dev.toolkit.illinois.edu/content/$COMPONENT_NAME --recursive
18
+ - name: Invalidate Cloudfront cache
19
+ run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT_DEV }} --paths "/$COMPONENT_NAME*"
@@ -0,0 +1,38 @@
1
+ name: deploy_development
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ version:
6
+ description: 'Version number'
7
+ required: true
8
+ default: ''
9
+ type: string
10
+ env:
11
+ MAJORVERSION: ''
12
+ COMPONENT_NAME: 'ilw-hero' # set this to the web component name you are using
13
+ jobs:
14
+ build:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: 'Checkout GitHub Action'
18
+ uses: actions/checkout@v4
19
+ - name: Get version from input
20
+ run: echo "VERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV
21
+ env:
22
+ GITHUB_BRANCH: ${{ github.event.inputs.version }}
23
+ - name: Display version install
24
+ run: echo "Installing dev version ${VERSION}"
25
+
26
+ - run: npm install
27
+ - run: npm rebuild
28
+ - run: npm run-script build
29
+ - name: Configure AWS Credentials
30
+ uses: aws-actions/configure-aws-credentials@v1
31
+ with:
32
+ aws-access-key-id: ${{ vars.TOOLKIT_AWS_ACCESS_KEY }}
33
+ aws-secret-access-key: ${{ secrets.TOOLKIT_AWS_ACCESS_SECRET }}
34
+ aws-region: us-east-2
35
+ - name: Deploy toolbox to S3 bucket
36
+ run: aws s3 sync ./dist/ s3://dev.toolkit.illinois.edu/content/$COMPONENT_NAME/$VERSION --delete --acl bucket-owner-full-control
37
+ - name: Invalidate Cloudfront cache
38
+ run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT_DEV }} --paths "/$COMPONENT_NAME/$VERSION*"
@@ -0,0 +1,64 @@
1
+ name: deploy_production
2
+ on:
3
+ push:
4
+ tags: [ '**' ]
5
+ env:
6
+ MAJORVERSION: ''
7
+ MINORVERSION: ''
8
+ FULLVERSION: ''
9
+ COMPONENT_NAME: 'ilw-hero' # set this to the web component name you are using
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: 'Checkout GitHub Action'
15
+ uses: actions/checkout@v4
16
+ - name: 'Get Version'
17
+ id: get_version
18
+ uses: battila7/get-version-action@v2
19
+
20
+ - name: 'Check for correct naming convention'
21
+ if: ${{ !steps.get_version.outputs.is-semver }}
22
+ run: exit 1
23
+ - name: 'Get major version from tag'
24
+ run: echo "MAJORVERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV
25
+ env:
26
+ GITHUB_BRANCH: ${{ steps.get_version.outputs.major }}
27
+ - name: 'Get minor version from tag'
28
+ run: echo "MINORVERSION=${GITHUB_BRANCH}.${GITHUB_BRANCH_MINOR}" >> $GITHUB_ENV
29
+ env:
30
+ GITHUB_BRANCH: ${{ steps.get_version.outputs.major }}
31
+ GITHUB_BRANCH_MINOR: ${{ steps.get_version.outputs.minor }}
32
+ - name: Get patch (full) version from tag
33
+ run: echo "FULLVERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV
34
+ env:
35
+ GITHUB_BRANCH: ${{ steps.get_version.outputs.version-without-v }}
36
+ - name: Display major version install
37
+ run: echo "Installing major version ${MAJORVERSION}"
38
+ - name: Display minor version install
39
+ run: echo "Installing minor version ${MINORVERSION}"
40
+ - name: Display patch (full) version install
41
+ run: echo "Installing patch (full) version ${FULLVERSION}"
42
+
43
+ - run: npm install
44
+ - run: npm rebuild
45
+ - run: npm run-script build
46
+ - name: Configure AWS Credentials
47
+ uses: aws-actions/configure-aws-credentials@v1
48
+ with:
49
+ aws-access-key-id: ${{ vars.TOOLKIT_AWS_ACCESS_KEY }}
50
+ aws-secret-access-key: ${{ secrets.TOOLKIT_AWS_ACCESS_SECRET }}
51
+ aws-region: us-east-2
52
+
53
+ - name: Deploy toolbox to S3 bucket for major version
54
+ run: aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$MAJORVERSION --delete --acl bucket-owner-full-control
55
+ - name: Invalidate Cloudfront cache for major version
56
+ run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$MAJORVERSION*"
57
+ - name: Deploy toolbox to S3 bucket for minor version
58
+ run: aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$MINORVERSION --delete --acl bucket-owner-full-control
59
+ - name: Invalidate Cloudfront cache for minor version
60
+ run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$MINORVERSION*"
61
+ - name: Deploy toolbox to S3 bucket for patch (full) version
62
+ run: aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$FULLVERSION --delete --acl bucket-owner-full-control
63
+ - name: Invalidate Cloudfront cache for patch (full) version
64
+ run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$FULLVERSION*"
@@ -0,0 +1,41 @@
1
+ name: deploy_production_manual
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ version:
6
+ description: 'Version number'
7
+ required: true
8
+ default: ''
9
+ type: string
10
+ env:
11
+ MAJORVERSION: ''
12
+ MINORVERSION: ''
13
+ FULLVERSION: ''
14
+ COMPONENT_NAME: 'ilw-hero' # set this to the web component name you are using
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: 'Checkout GitHub Action'
20
+ uses: actions/checkout@v4
21
+ - name: Get version from input
22
+ run: echo "VERSION=${GITHUB_BRANCH}" >> $GITHUB_ENV
23
+ env:
24
+ GITHUB_BRANCH: ${{ github.event.inputs.version }}
25
+ - name: Display version install
26
+ run: echo "Installing dev version ${VERSION}"
27
+
28
+ - run: npm install
29
+ - run: npm rebuild
30
+ - run: npm run-script build
31
+ - name: Configure AWS Credentials
32
+ uses: aws-actions/configure-aws-credentials@v1
33
+ with:
34
+ aws-access-key-id: ${{ vars.TOOLKIT_AWS_ACCESS_KEY }}
35
+ aws-secret-access-key: ${{ secrets.TOOLKIT_AWS_ACCESS_SECRET }}
36
+ aws-region: us-east-2
37
+
38
+ - name: Deploy toolbox to S3 bucket for version
39
+ run: aws s3 sync ./dist/ s3://cdn.toolkit.illinois.edu/content/$COMPONENT_NAME/$VERSION --delete --acl bucket-owner-full-control
40
+ - name: Invalidate Cloudfront cache for version
41
+ run: aws cloudfront create-invalidation --distribution-id ${{ vars.TOOLKIT_AWS_CLOUDFRONT }} --paths "/$COMPONENT_NAME/$VERSION*"
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # Sample README
2
+
3
+ ## Overview
4
+
5
+ Hero component for the web toolkit. The Hero Image component adds a large picture at the top of the page. It is used to draw attention to the page and can be used to set the tone for the page.
6
+
7
+ There is one slot, called "background", used for the background item. This is optional, but is most likely an image.
8
+
9
+ The default text should include a header (h1, h2, h3) and possibly a button list. The buttons will need to be styled separately.
10
+
11
+ Attributes include:
12
+ * theme: the theme/background of the content. Options are blue, orange, gray, blue-gradient, orange-gradient
13
+ * width: whether or not this is contained in the parent (default) or if it will expand to full width (full). Auto will not work in this case.
14
+ * align: whether or not the text is vertical or horizonally aligned (top-left, left-center, right-bottom, etc.)
15
+ * focus: if the image has a focal point if it shrinks or not. Values are top, bottom, left, right. Default is center.
16
+ * shadow: if the text should have a drop shadow on it.
17
+ * collapse: if the image should disappear in mobile view (useful if the image is just a blank pattern or does not give relevant information)
18
+
19
+ ## Contact Team
20
+
21
+ jonker@illinois.edu
22
+
23
+ ## NPM Install
24
+
25
+ None yet, still in alpha.
26
+
27
+ ## Files
28
+
29
+ None yet, still in alpha.
30
+
31
+ ## Code Examples
32
+
33
+ ```
34
+ <ilw-hero align="left" focus="bottom" shadow theme="white">
35
+ <img src="https://picsum.photos/1920/1280" alt="" slot="background">
36
+ <h1>Innovating solutions every year</h1>
37
+ <ul class="ilw-buttons">
38
+ <li>
39
+ <a href="#">Link 1</a>
40
+ </li>
41
+ <li>
42
+ <a href="#">Link 2</a>
43
+ </li>
44
+ <li>
45
+ <a href="#">Link 3</a>
46
+ </li>
47
+ </ul>
48
+ </ilw-hero>
49
+ ```
50
+
51
+ ```
52
+ <ilw-hero collapse="true">
53
+ <h2>Innovating solutions every year</h2>
54
+ <ul class="ilw-buttons">
55
+ <li>
56
+ <a href="#">Link 1</a>
57
+ </li>
58
+ <li>
59
+ <a href="#">Link 2</a>
60
+ </li>
61
+ <li>
62
+ <a href="#">Link 3</a>
63
+ </li>
64
+ </ul>
65
+ </ilw-hero>
66
+ ```
67
+
68
+ ```
69
+ <ilw-hero>
70
+ <video slot="background" autoplay="" loop="" muted="" poster="https://cdn-e.education.illinois.edu/video/first_image.png"><source src="https://cdn-e.education.illinois.edu/video/homepage8.mp4" type="video/mp4">Your browser does not support the video tag.
71
+ </video>
72
+ <h2>Innovating solutions every year</h2>
73
+ <ul class="ilw-buttons">
74
+ <li>
75
+ <a href="#">Link 1</a>
76
+ </li>
77
+ <li>
78
+ <a href="#">Link 2</a>
79
+ </li>
80
+ <li>
81
+ <a href="#">Link 3</a>
82
+ </li>
83
+ </ul>
84
+ </ilw-hero>
85
+ ```
86
+
87
+ ## Accessibility Notes and Use
88
+
89
+ The obvious one is color contrast. Make sure you have an image that text can overlay on. Match the theme with the dominant color of the image (so if you have a white image, use the white theme, if you have a dark image, use the blue theme). Make sure you test using multiple screen sizes, as the image will shift based on the size of the screen. If you need assistance, you can use the shadow option to put a shadow in front of the heading text.
90
+
91
+ For a graphic, make sure you choose a graphic that would reasonably display on a monitor. Do not choose a portrait image, or it will be cropped oddly.
92
+
93
+ You can include buttons using the ilw-buttons class or ilw-button class.
94
+
95
+ ## External references
96
+
97
+ https://usability.yale.edu/usability-best-practices/hero-imagescarousels
@@ -0,0 +1,11 @@
1
+ {
2
+ "title": "Hero",
3
+ "tag": "ilw-hero",
4
+ "github": "https://github.com/web-illinois/ilw-hero/",
5
+ "type": "web component",
6
+ "element-name": "ilw-hero",
7
+ "description": "The Hero Image component adds a large picture at the top of the page. It is used to draw attention to the page and can be used to set the tone for the page.",
8
+ "toolkit-version": "",
9
+ "production-version": "",
10
+ "development-version": "1.0.0-alpha"
11
+ }
@@ -0,0 +1,136 @@
1
+ {
2
+ "title": "Hero",
3
+ "tag": "ilw-hero",
4
+ "github": "https://github.com/web-illinois/ilw-hero/",
5
+ "type": "web component",
6
+ "element-name": "ilw-hero",
7
+ "description": "The Hero Image component adds a large picture at the top of the page. It is used to draw attention to the page and can be used to set the tone for the page.",
8
+ "version": "1.0.0-alpha",
9
+ "date": "5/22/2024",
10
+ "css": "https://dev.toolkit.illinois.edu/ilw-hero/1.0.0-alpha/ilw-hero.css",
11
+ "js": "https://dev.toolkit.illinois.edu/ilw-hero/1.0.0-alpha/ilw-hero.js",
12
+ "production": false,
13
+ "notes": "",
14
+ "parent-style": "",
15
+ "samples": [
16
+ {
17
+ "name": "default",
18
+ "description": "Default information with image",
19
+ "text": "<img src='https://picsum.photos/1920/1280' alt='' slot='background'><h1>Innovating solutions every year</h1><ul class='ilw-buttons'><li><a href='#'>Link 1</a></li><li><a href='#'>Link 2</a></li><li><a href='#'>Link 3</a></li></ul>"
20
+ },
21
+ {
22
+ "name": "noimage",
23
+ "description": "No image",
24
+ "text": "<h1>Innovating solutions every year</h1><ul class='ilw-buttons'><li><a href='#'>Link 1</a></li><li><a href='#'>Link 2</a></li><li><a href='#'>Link 3</a></li></ul>"
25
+ },
26
+ {
27
+ "name": "video",
28
+ "description": "Video background",
29
+ "text": "<video slot='background' autoplay='' loop='' muted='' poster='https://cdn-e.education.illinois.edu/video/first_image.png'><source src='https://cdn-e.education.illinois.edu/video/homepage8.mp4' type='video/mp4'>Your browser does not support the video tag.</video><h2>Innovating solutions every year</h2><ul class='ilw-buttons'><li><a href='#''>Link 1</a></li><li><a href='#'>Link 2</a></li><li><a href='#''>Link 3</a></li></ul>"
30
+ }
31
+ ],
32
+ "attributes-fixed": [],
33
+ "attributes-text": [],
34
+ "attributes": [
35
+ {
36
+ "name": "theme",
37
+ "description": "Color theme used",
38
+ "depreciated": false,
39
+ "values": [
40
+ "",
41
+ "blue",
42
+ "orange",
43
+ "white"
44
+ ]
45
+ },
46
+ {
47
+ "name": "align",
48
+ "description": "Text alignment, defaults to center",
49
+ "depreciated": false,
50
+ "values": [
51
+ "",
52
+ "top",
53
+ "bottom",
54
+ "left",
55
+ "right",
56
+ "top-left",
57
+ "top-right",
58
+ "bottom-left",
59
+ "bottom-right"
60
+ ]
61
+ },
62
+ {
63
+ "name": "focus",
64
+ "description": "Focus for the image, defaults to center",
65
+ "depreciated": false,
66
+ "values": [
67
+ "",
68
+ "top",
69
+ "bottom",
70
+ "left",
71
+ "right"
72
+ ]
73
+ },
74
+ {
75
+ "name": "width",
76
+ "description": "Whether or not this follows current borders or is full width",
77
+ "depreciated": false,
78
+ "values": [
79
+ "",
80
+ "full"
81
+ ]
82
+ },
83
+ {
84
+ "name": "shadow",
85
+ "description": "Whether or not to include a shadow",
86
+ "depreciated": false,
87
+ "values": [
88
+ "",
89
+ "true"
90
+ ]
91
+ },
92
+ {
93
+ "name": "collapse",
94
+ "description": "Whether or not to remove the image / background in mobile",
95
+ "depreciated": false,
96
+ "values": [
97
+ "",
98
+ "true"
99
+ ]
100
+ }
101
+ ],
102
+ "classes-fixed": [],
103
+ "classes": [],
104
+ "css-variables": [
105
+ {
106
+ "name": "--ilw-hero--height",
107
+ "depreciated": false,
108
+ "description": "Size of the hero image"
109
+ },
110
+ {
111
+ "name": "--ilw-hero--font",
112
+ "depreciated": false,
113
+ "description": "Font for heading"
114
+ },
115
+ {
116
+ "name": "--ilw-hero--background",
117
+ "depreciated": false,
118
+ "description": "Hex color for background"
119
+ },
120
+ {
121
+ "name": "--ilw-hero--text-width",
122
+ "depreciated": false,
123
+ "description": "Text width for heading"
124
+ },
125
+ {
126
+ "name": "--ilw-hero--shadow-color",
127
+ "depreciated": false,
128
+ "description": "Hex color for shadow in rgba format"
129
+ },
130
+ {
131
+ "name": "--ilw-hero--text-color",
132
+ "depreciated": false,
133
+ "description": "Hex color for heading"
134
+ }
135
+ ]
136
+ }
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@illinois-toolkit/ilw-hero",
3
+ "private": false,
4
+ "version": "0.9.1",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./src/ilw-hero.js"
9
+ }
10
+ },
11
+ "scripts": {
12
+ "dev": "vite",
13
+ "build": "vite build --config vite.build.config.js --emptyOutDir",
14
+ "preview": "vite preview"
15
+ },
16
+ "dependencies": {
17
+ "lit": "3.1.3"
18
+ },
19
+ "devDependencies": {
20
+ "vite": "^5.2.0"
21
+ }
22
+ }
@@ -0,0 +1,53 @@
1
+ <!doctype html>
2
+ <meta charset="UTF-8" />
3
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
4
+ <title>Hero Component</title>
5
+ <link rel="stylesheet" href="https://cdn.brand.illinois.edu/illinois.css">
6
+ <link rel="stylesheet" href="https://dev.toolkit.illinois.edu/ilw-global/3.0.0-alpha/ilw-global.css">
7
+ <script type="module" src="/src/ilw-hero.js"></script>
8
+
9
+ <script>
10
+ document.addEventListener("DOMContentLoaded", function(event) {
11
+ const params = new URLSearchParams(window.location.search);
12
+ document.querySelectorAll("ilw-hero").forEach(component => {
13
+ if (params.has('theme')) {
14
+ component.setAttribute('theme', params.get('theme'));
15
+ }
16
+ if (params.has('width')) {
17
+ component.setAttribute('width', params.get('width'));
18
+ }
19
+ if (params.has('align')) {
20
+ component.setAttribute('align', params.get('align'));
21
+ }
22
+ if (params.has('focus')) {
23
+ component.setAttribute('focus', params.get('focus'));
24
+ }
25
+ if (params.has('shadow')) {
26
+ component.setAttribute('shadow', params.get('shadow'));
27
+ }
28
+ });
29
+ document.querySelectorAll(".ilw-buttons").forEach(buttons => {
30
+ if (params.has('buttontheme')) {
31
+ buttons.classList.add('ilw-theme-' + params.get('buttontheme'));
32
+ }
33
+ });
34
+ });
35
+ </script>
36
+
37
+ <body style="margin: 0 auto; padding: 0; max-width: 1200px;">
38
+ <ilw-hero>
39
+ <img src="https://picsum.photos/1920/1280" alt="" slot="background">
40
+ <h1>Innovating solutions every year</h1>
41
+ <ul class="ilw-buttons">
42
+ <li>
43
+ <a href="#">Link 1</a>
44
+ </li>
45
+ <li>
46
+ <a href="#">Link 2</a>
47
+ </li>
48
+ <li>
49
+ <a href="#">Link 3</a>
50
+ </li>
51
+ </ul>
52
+ </ilw-hero>
53
+ </body>
@@ -0,0 +1,52 @@
1
+ <!doctype html>
2
+ <meta charset="UTF-8" />
3
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
4
+ <title>Hero Component</title>
5
+ <link rel="stylesheet" href="https://cdn.brand.illinois.edu/illinois.css">
6
+ <link rel="stylesheet" href="https://dev.toolkit.illinois.edu/ilw-global/3.0.0-alpha/ilw-global.css">
7
+ <script type="module" src="/src/ilw-hero.js"></script>
8
+
9
+ <script>
10
+ document.addEventListener("DOMContentLoaded", function(event) {
11
+ const params = new URLSearchParams(window.location.search);
12
+ document.querySelectorAll("ilw-hero").forEach(component => {
13
+ if (params.has('theme')) {
14
+ component.setAttribute('theme', params.get('theme'));
15
+ }
16
+ if (params.has('width')) {
17
+ component.setAttribute('width', params.get('width'));
18
+ }
19
+ if (params.has('align')) {
20
+ component.setAttribute('align', params.get('align'));
21
+ }
22
+ if (params.has('focus')) {
23
+ component.setAttribute('focus', params.get('focus'));
24
+ }
25
+ if (params.has('shadow')) {
26
+ component.setAttribute('shadow', params.get('shadow'));
27
+ }
28
+ });
29
+ document.querySelectorAll(".ilw-buttons").forEach(buttons => {
30
+ if (params.has('buttontheme')) {
31
+ buttons.classList.add('ilw-theme-' + params.get('buttontheme'));
32
+ }
33
+ });
34
+ });
35
+ </script>
36
+
37
+ <body style="margin: 0 auto; padding: 0; max-width: 1200px;">
38
+ <ilw-hero>
39
+ <h2>Innovating solutions every year</h2>
40
+ <ul class="ilw-buttons">
41
+ <li>
42
+ <a href="#">Link 1</a>
43
+ </li>
44
+ <li>
45
+ <a href="#">Link 2</a>
46
+ </li>
47
+ <li>
48
+ <a href="#">Link 3</a>
49
+ </li>
50
+ </ul>
51
+ </ilw-hero>
52
+ </body>
@@ -0,0 +1,42 @@
1
+ <!doctype html>
2
+ <meta charset="UTF-8" />
3
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
4
+ <title>Hero Component</title>
5
+ <link rel="stylesheet" href="https://cdn.brand.illinois.edu/illinois.css">
6
+ <link rel="stylesheet" href="https://dev.toolkit.illinois.edu/ilw-global/3.0.0-alpha/ilw-global.css">
7
+ <script type="module" src="/src/ilw-hero.js"></script>
8
+
9
+ <script>
10
+ document.addEventListener("DOMContentLoaded", function(event) {
11
+ const params = new URLSearchParams(window.location.search);
12
+ document.querySelectorAll("ilw-hero").forEach(component => {
13
+ if (params.has('theme')) {
14
+ component.setAttribute('theme', params.get('theme'));
15
+ }
16
+ if (params.has('width')) {
17
+ component.setAttribute('width', params.get('width'));
18
+ }
19
+ if (params.has('align')) {
20
+ component.setAttribute('align', params.get('align'));
21
+ }
22
+ if (params.has('focus')) {
23
+ component.setAttribute('focus', params.get('focus'));
24
+ }
25
+ if (params.has('shadow')) {
26
+ component.setAttribute('shadow', params.get('shadow'));
27
+ }
28
+ });
29
+ document.querySelectorAll(".ilw-button").forEach(buttons => {
30
+ if (params.has('buttontheme')) {
31
+ buttons.classList.add('ilw-theme-' + params.get('buttontheme'));
32
+ }
33
+ });
34
+ });
35
+ </script>
36
+
37
+ <body style="margin: 0 auto; padding: 0; max-width: 1200px;">
38
+ <ilw-hero>
39
+ <h2>Innovating solutions every year</h2>
40
+ <p><a href="#" class="ilw-button">Link 1</a></p>
41
+ </ilw-hero>
42
+ </body>
@@ -0,0 +1,57 @@
1
+ <!doctype html>
2
+ <meta charset="UTF-8" />
3
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
4
+ <title>Hero Component</title>
5
+ <link rel="stylesheet" href="https://cdn.brand.illinois.edu/illinois.css">
6
+ <link rel="stylesheet" href="https://dev.toolkit.illinois.edu/ilw-global/3.0.0-alpha/ilw-global.css">
7
+ <script type="module" src="/src/ilw-hero.js"></script>
8
+
9
+ <script>
10
+ document.addEventListener("DOMContentLoaded", function(event) {
11
+ const params = new URLSearchParams(window.location.search);
12
+ document.querySelectorAll("ilw-hero").forEach(component => {
13
+ if (params.has('theme')) {
14
+ component.setAttribute('theme', params.get('theme'));
15
+ }
16
+ if (params.has('width')) {
17
+ component.setAttribute('width', params.get('width'));
18
+ }
19
+ if (params.has('align')) {
20
+ component.setAttribute('align', params.get('align'));
21
+ }
22
+ if (params.has('focus')) {
23
+ component.setAttribute('focus', params.get('focus'));
24
+ }
25
+ if (params.has('shadow')) {
26
+ component.setAttribute('shadow', params.get('shadow'));
27
+ }
28
+ });
29
+ document.querySelectorAll(".ilw-buttons").forEach(buttons => {
30
+ if (params.has('buttontheme')) {
31
+ buttons.classList.add('ilw-theme-' + params.get('buttontheme'));
32
+ }
33
+ });
34
+ });
35
+ </script>
36
+
37
+ <body style="margin: 0 auto; padding: 0; max-width: 1200px;">
38
+ <ilw-hero>
39
+ <video slot="background" autoplay="" loop="" muted=""
40
+ poster="https://cdn-e.education.illinois.edu/video/first_image.png">
41
+ <source src="https://cdn-e.education.illinois.edu/video/homepage8.mp4" type="video/mp4">Your browser does not
42
+ support the video tag.
43
+ </video>
44
+ <h2>Innovating solutions every year</h2>
45
+ <ul class="ilw-buttons">
46
+ <li>
47
+ <a href="#">Link 1</a>
48
+ </li>
49
+ <li>
50
+ <a href="#">Link 2</a>
51
+ </li>
52
+ <li>
53
+ <a href="#">Link 3</a>
54
+ </li>
55
+ </ul>
56
+ </ilw-hero>
57
+ </body>
@@ -0,0 +1,86 @@
1
+ :root {
2
+ --ilw-hero--height: 223px;
3
+ --ilw-hero--font: 700 2.25rem/2.25rem var(--il-font-sans);
4
+ --ilw-hero--background: var(--il-blue);
5
+ --ilw-hero--text-color: white;
6
+ --ilw-hero--text-width: 40%;
7
+ --ilw-hero--shadow-color: rgba(0, 0, 0, 1);
8
+ }
9
+
10
+ ilw-hero {
11
+ img, *[slot="background"] {
12
+ display: block;
13
+ position: relative;
14
+ width: 100%;
15
+ height: 100%;
16
+ object-fit: cover;
17
+ object-position: center;
18
+ }
19
+
20
+ h1, h2, h3 {
21
+ all: initial;
22
+ font: var(--ilw-hero--font);
23
+ color: var(--ilw-hero--text-color);
24
+ text-shadow: 2px 2px 2px var(--ilw-hero--shadow-color);
25
+ text-align: inherit;
26
+ }
27
+
28
+ &[theme="orange"] {
29
+ --ilw-hero--background: var(--il-orange);
30
+ --ilw-hero--button-background-color: var(--il-blue);
31
+ --ilw-hero--focused-button-foreground-color: var(--il-blue);
32
+ }
33
+
34
+ &[theme="white"] {
35
+ --ilw-hero--background: white;
36
+ --ilw-hero--button-background-color: white;
37
+ --ilw-hero--button-foreground-color: var(--il-blue);
38
+ --ilw-hero--button-border-color: var(--il-blue);
39
+ --ilw-hero--focused-button-background-color: var(--il-blue);
40
+ --ilw-hero--focused-button-foreground-color: white;
41
+ --ilw-hero--focused-button-border-color: var(--il-blue);
42
+ --ilw-hero--text-color: #252525;
43
+ --ilw-hero--shadow-color: rgba(255, 255, 255, 1);
44
+ }
45
+
46
+ &[focus="top"] img {
47
+ object-position: top;
48
+ }
49
+ &[focus="bottom"] img {
50
+ object-position: bottom;
51
+ }
52
+ &[focus="left"] img {
53
+ object-position: left;
54
+ }
55
+ &[focus="right"] img {
56
+ object-position: right;
57
+ }
58
+ }
59
+
60
+ @media (min-width: 576px) {
61
+ :root {
62
+ --ilw-hero--height: 315px;
63
+ --ilw-hero--font: 700 3rem/3rem var(--il-font-sans);
64
+ }
65
+ }
66
+
67
+ @media (min-width: 767px) {
68
+ :root {
69
+ --ilw-hero--height: 557px;
70
+ --ilw-hero--font: 700 4rem/4rem var(--il-font-sans);
71
+ }
72
+ ilw-hero[shadow] h1, ilw-hero[shadow] h2, ilw-hero[shadow] h3 {
73
+ background: radial-gradient(rgba(0,0,0,.9),rgba(0,0,0,0.1));
74
+ padding: 1rem!important;
75
+ }
76
+
77
+ ilw-hero[theme="white"][shadow] h1, ilw-hero[theme="white"][shadow] h2, ilw-hero[theme="white"][shadow] h3 {
78
+ background: radial-gradient(rgba(255,255,255,.9),rgba(255,255,255,0.1));
79
+ }
80
+ }
81
+
82
+ @media (min-width: 992px) {
83
+ :root {
84
+ --ilw-hero--font: 700 4.5rem/4.5rem var(--il-font-sans);
85
+ }
86
+ }
@@ -0,0 +1,52 @@
1
+ import { LitElement, html } from 'lit';
2
+ import styles from './ilw-hero.styles';
3
+ import './ilw-hero.css';
4
+
5
+ class Hero extends LitElement {
6
+
7
+ static get properties() {
8
+ return {
9
+ theme: { type: String, attribute: true },
10
+ focus: { type: String, attribute: true },
11
+ shadow: { type: Boolean, attribute: true },
12
+ collapse: { type: Boolean, attribute: true },
13
+ align: { type: String, attribute: true },
14
+ width: { type: String, attribute: true }
15
+ };
16
+ }
17
+
18
+ static get styles() {
19
+ return styles;
20
+ }
21
+
22
+ constructor() {
23
+ super();
24
+ this.align = '';
25
+ this.focus = '';
26
+ this.shadow = false;
27
+ this.collapse = false;
28
+ this.theme = '';
29
+ this.width = '';
30
+ }
31
+
32
+ get outerWidth() {
33
+ return this.width == 'full' || this.width == 'auto' ? 'fixed' : '';
34
+ }
35
+
36
+ render() {
37
+ return html`
38
+ <div class="hero ${this.outerWidth}">
39
+ <div role="presentation" class="background ${this.collapse ? 'collapse' : ''}">
40
+ <slot name="background"></slot>
41
+ </div>
42
+ <div class="content-outer">
43
+ <div class="content-inner ${this.align.replace('-', ' ')}">
44
+ <slot></slot>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ `;
49
+ }
50
+ }
51
+
52
+ customElements.define('ilw-hero', Hero);
@@ -0,0 +1,141 @@
1
+ import { css } from 'lit';
2
+
3
+ export default css`
4
+
5
+ .hero {
6
+ position: relative;
7
+ }
8
+
9
+ .hero.fixed {
10
+ left:50%;
11
+ margin-left:-50vw;
12
+ margin-right:-50vw;
13
+ padding-left:0;
14
+ padding-right:0;
15
+ position:relative;
16
+ right:50%;
17
+ width:100vw;
18
+ }
19
+
20
+ .background {
21
+ position: relative;
22
+ width: 100%;
23
+ height: var(--ilw-hero--height, 223px);
24
+ background-color: var(--ilw-hero--background);
25
+ }
26
+
27
+ .background.collapse {
28
+ display: none;
29
+ }
30
+
31
+ img {
32
+ display: block;
33
+ position: relative;
34
+ object-fit: cover;
35
+ object-position: center;
36
+ }
37
+
38
+ .content-outer {
39
+ background: var(--ilw-hero--background);
40
+ position: relative;
41
+ z-index: 100;
42
+ padding: 0 20px;
43
+ }
44
+
45
+ .content-inner {
46
+ padding: 18px 0 36px 0;
47
+ }
48
+
49
+ @media (min-width: 576px) {
50
+ .content-inner {
51
+ padding: 36px 0px 72px;
52
+ }
53
+ }
54
+
55
+ @media (min-width: 767px) {
56
+ .background {
57
+ position: absolute;
58
+ width: 100%;
59
+ top: 0;
60
+ left: 0;
61
+ z-index: 1;
62
+ }
63
+ .background img {
64
+ position: absolute;
65
+ width: 100%;
66
+ height: 100%;
67
+ top: 0;
68
+ left: 0;
69
+ z-index: 101;
70
+ }
71
+ .background.collapse {
72
+ display: block;
73
+ }
74
+
75
+
76
+ .content-outer {
77
+ background: transparent;
78
+ height: var(--ilw-hero--height, 223px);
79
+ display: flex;
80
+ }
81
+
82
+ .content-inner {
83
+ width: 60%;
84
+ margin: auto;
85
+ display: flex;
86
+ flex-direction: column;
87
+ text-align: center;
88
+ align-items: center;
89
+ max-width: 1200px;
90
+ }
91
+
92
+ .content-inner.left {
93
+ text-align: left;
94
+ align-items: flex-start;
95
+ margin-left: 100px;
96
+ }
97
+
98
+ .content-inner.right {
99
+ text-align: right;
100
+ align-items: flex-end;
101
+ margin-right: 100px;
102
+ }
103
+
104
+ .content-inner.top {
105
+ margin-top: 0;
106
+ }
107
+
108
+ .content-inner.bottom {
109
+ margin-bottom: 0;
110
+ }
111
+ .content-inner.top-left {
112
+ text-align: left;
113
+ align-items: flex-start;
114
+ margin: 0 auto auto 100px;
115
+ }
116
+
117
+ .content-inner.top-right {
118
+ text-align: left;
119
+ align-items: flex-start;
120
+ margin: 0 100px auto auto;
121
+ }
122
+
123
+ .content-inner.bottom-left {
124
+ text-align: right;
125
+ align-items: flex-end;
126
+ margin: auto auto 0 100px;
127
+ }
128
+
129
+ .content-inner.bottom-right {
130
+ text-align: right;
131
+ align-items: flex-end;
132
+ margin: auto 100px 0 auto;
133
+ }
134
+ }
135
+
136
+ @media (min-width: 992px) {
137
+ .content-inner {
138
+ width: var(--ilw-hero--text-width);
139
+ }
140
+ }
141
+ `;
@@ -0,0 +1,25 @@
1
+ import { defineConfig } from 'vite'
2
+
3
+ // https://vitejs.dev/config/
4
+ export default defineConfig({
5
+ root: 'src',
6
+ build: {
7
+ outDir: '../dist',
8
+ lib: {
9
+ name: 'ilw-hero',
10
+ entry: 'ilw-hero.js',
11
+ fileName: 'ilw-hero',
12
+ formats: ['es', 'cjs', 'umd'],
13
+ },
14
+ rollupOptions: {
15
+ output: {
16
+ assetFileNames: (chunkInfo) => {
17
+ if (chunkInfo.name === 'style.css') return 'ilw-hero.css';
18
+ }
19
+ }
20
+ },
21
+ },
22
+ server: {
23
+ hmr: false
24
+ }
25
+ })