Skip to content

Commit

Permalink
Adding page width, using ilw-margin--side
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjonker-illinois committed Sep 3, 2024
1 parent d355698 commit 71ab3b0
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 15 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ This is meant to take the place of the old il-image-feature and il-video-feature
### Attributes
* **mode**: the relative size and position of the columns. See below for options.
* **theme**: `blue`, `orange`, `blue-gradient`, `orange-gradient`, `gray`, `white`. Defaults to white. This is only the background of the columns.
* **width:** no width attribute will make it fit the container, `full` will break the container and go full width, and `auto` will break the container, but only for the background
* **gap**: a length / percentage CSS of padding between the columns. Defaults to `0 0 40px 0` to handle padding.
* **padding**: standard length / percentage CSS of padding around the grid. Defaults to none.
* **width:** no width attribute will make it fit the container, `full` will break the container and go full width, `auto` will break the container, but only for the background, and `page` will contain the contents but allow the background to go full width.
* **gap**: a length / percentage CSS of padding between the columns. Defaults to none.
* **padding**: standard length / percentage CSS of padding around the grid. Defaults to `0 0 40px 0` to handle padding.
* **reverse**: If the columns should reverse, so items on the left will show up on the right. This will have no effect on a smaller container where it stacks.

### Mode options
Expand Down
2 changes: 1 addition & 1 deletion builder/ilw-columns.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"description": "Creates a single row of items that you can use to display information, with information of different widths.",
"toolkit-version": "",
"production-version": "",
"development-version": "1.0.0-alpha1"
"development-version": "1.0.0-alpha2"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"type": "web component",
"element-name": "ilw-columns",
"description": "Creates a single row of items that you can use to display information, with information of different widths.",
"version": "1.0.0-alpha1",
"version": "1.0.0-alpha2",
"date": "07/17/2024",
"css": "https://dev.toolkit.illinois.edu/ilw-columns/1.0.0-alpha1/ilw-columns.css",
"js": "https://dev.toolkit.illinois.edu/ilw-columns/1.0.0-alpha1/ilw-columns.js",
"css": "https://dev.toolkit.illinois.edu/ilw-columns/1.0.0-alpha2/ilw-columns.css",
"js": "https://dev.toolkit.illinois.edu/ilw-columns/1.0.0-alpha2/ilw-columns.js",
"production": false,
"notes": "",
"parent-style": "",
Expand Down Expand Up @@ -75,7 +75,8 @@
"values": [
"",
"full",
"auto"
"auto",
"page"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Illinois Toolkit: This uses the CSS flexbox to split the container into multiple sections.",
"repository": "github:web-illinois/ilw-columns",
"private": false,
"version": "1.0.0-alpha1",
"version": "1.0.0-alpha2",
"type": "module",
"files": [
"src/**",
Expand Down
56 changes: 56 additions & 0 deletions samples/nopadding.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Columns Component</title>
<link rel="stylesheet" href="https://cdn.brand.illinois.edu/illinois.css">
<link rel="stylesheet" href="https://dev.toolkit.illinois.edu/ilw-global/3.0.0-alpha/ilw-global.css">
<script type="module" src="/src/ilw-columns.js"></script>
</head>

<style>
div.test {
background: white;
border: thin solid black;
padding: 10px;
}
</style>


<script>
document.addEventListener("DOMContentLoaded", function(event) {
const params = new URLSearchParams(window.location.search);
document.querySelectorAll("ilw-columns").forEach(component => {
if (params.has('theme')) {
component.setAttribute('theme', params.get('theme'));
}
if (params.has('mode')) {
component.setAttribute('mode', params.get('mode'));
}
if (params.has('width')) {
component.setAttribute('width', params.get('width'));
}
if (params.has('padding')) {
component.setAttribute('padding', params.get('padding'));
}
if (params.has('gap')) {
component.setAttribute('gap', params.get('gap'));
}
if (params.has('reverse')) {
component.setAttribute('reverse', params.get('reverse'));
}
});
});
</script>

<body>
<ilw-columns id="test-item">
<div class="test"><h3>Lorem ipsum dolor sit amet</h3><p>Consectetur adipiscing elit. <div>Donec posuere dui mauris, eu scelerisque mauris mattis in. Nunc sed leo arcu. Nulla non eleifend sapien.</div> </p></div>
<div class="test"><h3>Lorem ipsum dolor sit amet</h3><p>Nunc sed leo arcu. Nulla non eleifend sapien. </p></div>
</ilw-columns>
</body>
</body>

</html>
3 changes: 0 additions & 3 deletions src/ilw-columns.css

This file was deleted.

3 changes: 1 addition & 2 deletions src/ilw-columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { LitElement, html } from 'lit';
import { map } from 'lit/directives/map.js';
import styles from './ilw-columns.styles';
import { ManualSlotController } from './ManualSlotController.js';
import './ilw-columns.css';

class Columns extends LitElement {
static shadowRootOptions = {...LitElement.shadowRootOptions, slotAssignment: "manual"};
Expand Down Expand Up @@ -73,7 +72,7 @@ class Columns extends LitElement {
}

get innerWidth() {
return this.width == 'auto' ? 'fixed' : '';
return this.width == 'auto' || this.width == 'page' ? 'fixed' : '';
}

render() {
Expand Down
2 changes: 1 addition & 1 deletion src/ilw-columns.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default css`
}
div.columns.fixed {
margin: var(--ilw-columns--main-margin, 0);
margin: 0 var(--ilw-margin--side, 0);
}
div.columns > div {
Expand Down

0 comments on commit 71ab3b0

Please sign in to comment.