Skip to content

Commit

Permalink
Merge pull request #10 from mrtrimble/skelly-vite
Browse files Browse the repository at this point in the history
SkellyCSS Vite
  • Loading branch information
hougasian authored Jan 21, 2022
2 parents 021de95 + 878223b commit 07acab3
Show file tree
Hide file tree
Showing 12 changed files with 1,136 additions and 14,730 deletions.
52 changes: 40 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ A light-weight CSS framework to quickly implement skeletons into your projects.
- [Shapes](#shapes)
- [Animation](#animation)
- [JavaScript Utility](#javascript-utility)
- [JavaScript Data Attributes](#javascript-data-attributes)
- [All Data Attributes](#all-data-attributes)

<br />

Expand All @@ -34,15 +36,15 @@ To install via node package manager:
npm install @ritterim/skellycss
```
### CSS
Include the skelly.css file wherever you add your CSS:
Include the Skelly css file wherever you add your CSS:
``` html
<link rel="stylesheet" href="../dist/skelly.css">
<link rel="stylesheet" href="..@ritterim/skellycss/dist/style.css">
```

### JavaScript
Include the skelly.js file wherever you add your JavaScript:
``` html
<script src="../dist/skelly.js"></script>
<script src="..@ritterim/skellycss/dist/skelly.js"></script>
```

<br />
Expand Down Expand Up @@ -153,7 +155,7 @@ You can text align the skeleton using alignment modifier classes:
<br />

### Images
You can create an image skeleton by adding the `.skeleton-image` class to an img tag -- do not include the `src` attribute. By default this will apply the image skeleton at 100% height and width of the parent container.
You can create an image skeleton by using the `.skeleton-image` class. By default this will apply the image skeleton at 100% height and width of the parent container.

#### Sizes
Here are some default sizes we have included for skeleton images:
Expand Down Expand Up @@ -182,16 +184,20 @@ You can also make different image shapes using shape modifier classes:

| Shape | Description | Modifier Class |
| ------------ |------------ | ------------|
| Landscape Rectangle | Sets the width of the image to 100% | `.skeleton-image--landscape` |
| Portrait Rectangle | Sets the height of the image to 100% | `.skeleton-image--portrait` |
| Square | Sets the image aspect ratio to 1/1 (default) | `.skeleton-image--square` |
| Circle | Sets the border radius to 50% | `.skeleton-image--circle` |

![Image Shapes](images/image-shapes.png)
| Landscape Rectangle | Sets the image aspect ratio to 4/3 | `.skeleton-image--landscape` |
| Portrait Rectangle | Sets the image aspect ratio to 3/4| `.skeleton-image--portrait` |
| Wide Rectangle | Sets the image aspect ratio to 16/9 | `.skeleton-image--wide` |
| Tall Rectangle | Sets the image aspect ratio to 9/16 | `.skeleton-image--tall` |

``` html
<img class="skeleton-image skeleton-image--lg skeleton-image--landscape" />
<img class="skeleton-image skeleton-image--lg skeleton-image--portrait" />
<img class="skeleton-image skeleton-image--lg skeleton-image--circle" />
<div class="skeleton-image skeleton-image--lg skeleton-image--square"></div>
<div class="skeleton-image skeleton-image--lg skeleton-image--circle"></div>
<div class="skeleton-image skeleton-image--lg skeleton-image--landscape"></div>
<div class="skeleton-image skeleton-image--lg skeleton-image--portrait"></div>
<div class="skeleton-image skeleton-image--lg skeleton-image--wide"></div>
<div class="skeleton-image skeleton-image--lg skeleton-image--tall"></div>
```

<br />
Expand Down Expand Up @@ -239,4 +245,26 @@ You can also give the skeleton animation by adding the `data-animation` attribut
``` html
<h2 class="skeleton skeleton--md" data-animation="true"></h2>
<p class="skeleton" data-lines="7" data-animation="true"></p>
```
```

<br />

### JavaScript Data Attributes
You can alter the way skeleton looks by utilizing other data-attributes as well, including opacity and color:
``` html
<!-- Opacity -->
<h2 class="skeleton skeleton--md" data-animation="true"></h2>
<p class="skeleton" data-lines="7" data-opacity="0.3"></p>

<!-- Color -->
<h2 class="skeleton skeleton--md" data-animation="true"></h2>
<p class="skeleton" data-lines="7" data-color="tomato"></p>
```

#### All Data Attributes
| Attribute | Description | Type |
| ------------ |------------ | ------------|
| `data-lines` | Determines how many lines to output | Integer |
| `data-animation` | Adds animation to the skeleton lines | Boolean |
| `data-opacity` | Sets the opacity of the skeleton lines (sets opacity between 0 and 1) | Float |
| `data-color` | Sets the color of the skeleton lines | Color |
1 change: 0 additions & 1 deletion examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="../dist/skelly.css" />
<style>
#container {
box-sizing: border-box;
Expand Down
252 changes: 252 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
/* styling for index.html only, not included in package */
body {
font-family: sans-serif;
}
#title {
margin-bottom: 2rem;
}
#container {
--container-width: 120ch;

width: min(var(--container-width), 100% - 3rem);
margin-inline: auto;
}

#headers {
margin: 1em 0 2em;
border: 1px solid black;
padding: 1em;
}

#headers .skeleton {
margin-bottom: 0.5em;
}

.paragraphs {
margin: 1em 0 2em;
padding: 1em;
border: 1px solid black;
}

#line-widths {
margin: 1em 0 2em;
padding: 1em;
border: 1px solid black;
}

#alignment {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
column-gap: 1em;
margin: 1em 0 2em;
padding: 1em;
border: 1px solid black;
}

#images {
display: flex;
gap: 1rem;
justify-content: center;
margin: 1em 0 2em;
padding: 1em;
border: 1px solid black;
}

#images img {
margin: 1em;
}

#image-shapes {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
margin: 1em 0 2em;
gap:1rem;
padding: 1em;
border: 1px solid black;
}

@media screen and (min-width: 786px) {
#image-shapes {
flex-flow: row;
flex-wrap: wrap;
}
}

#image-shapes .image {
margin: 1em;
display: flex;
flex-flow: column;
gap: 1rem;
height: 300px;
align-items: center;
justify-content: center;
}

#animation {
margin: 1em 0 2em;
padding: 1em;
border: 1px solid black;
}

#opacity {
background:#759FC1;
}
</style>
</head>
<body>
<div id="container">
<h1 id="title">SkellyCSS</h1>
<!-- Headers -->
<h2>Headers</h2>
<div id="headers">
<h1 class="skeleton"></h1>
<h2 class="skeleton"></h2>
<h3 class="skeleton"></h3>
<h4 class="skeleton"></h4>
<h5 class="skeleton"></h5>
<h6 class="skeleton"></h6>
</div>

<!-- Paragraphs -->
<h2>Paragraphs</h2>
<div id="paragraphs" class="paragraphs">
<p class="skeleton" data-lines="6"></p>
</div>

<!-- Line Width -->
<h2>Line Widths</h2>
<div id="line-widths">
<h3>Small</h3>
<h1 class="skeleton skeleton--sm"></h1>
<h3>Medium</h3>
<h1 class="skeleton skeleton--md"></h1>
<h3>Large</h3>
<h1 class="skeleton skeleton--lg"></h1>
<h3>Full</h3>
<h1 class="skeleton skeleton--full"></h1>
</div>

<!-- Alignment -->
<h2>Alignment</h2>
<div id="alignment">
<!-- Left Align -->
<p class="skeleton skeleton--left">
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
</p>

<!-- Center Align -->
<p class="skeleton skeleton--center">
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
</p>

<!-- Right Align -->
<p class="skeleton skeleton--right">
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
<span class="skeleton__line"></span>
</p>
</div>

<h2>Images</h2>
<div id="images">
<div class="skeleton-image skeleton-image--sm"></div>
<div class="skeleton-image skeleton-image--md"></div>
<div class="skeleton-image skeleton-image--lg"></div>
<div class="skeleton-image skeleton-image--xl"></div>
</div>

<h2>Image Shapes</h2>
<div id="image-shapes">
<div class="image">
<h3>Square</h3>
<div
class="skeleton-image skeleton-image--lg skeleton-image--square"
></div>
</div>

<div class="image">
<h3>Circle</h3>
<div
class="skeleton-image skeleton-image--lg skeleton-image--circle"
></div>
</div>

<div class="image">
<h3>Landscape</h3>
<div
class="skeleton-image skeleton-image--lg skeleton-image--landscape"
></div>
</div>

<div class="image">
<h3>Portrait</h3>
<div
class="skeleton-image skeleton-image--lg skeleton-image--portrait"
></div>
</div>

<div class="image">
<h3>Wide</h3>
<div
class="skeleton-image skeleton-image--lg skeleton-image--wide"
></div>
</div>

<div class="image">
<h3>Tall</h3>
<div
class="skeleton-image skeleton-image--lg skeleton-image--tall"
></div>
</div>
</div>

<h2>Animation</h2>
<div id="animation">
<p class="skeleton">
<span class="skeleton__line">
<span class="skeleton--animation"></span>
</span>
<span class="skeleton__line">
<span class="skeleton--animation"></span>
</span>
<span class="skeleton__line">
<span class="skeleton--animation"></span>
</span>
<span class="skeleton__line">
<span class="skeleton--animation"></span>
</span>
</p>
</div>

<h2>Opacity</h2>
<div id="opacity" class="paragraphs">
<p class="skeleton" data-lines="6" data-opacity="0.3"></p>
</div>

<h2>Color</h2>
<div id="color" class="paragraphs">
<p class="skeleton" data-lines="6" data-color="rebeccapurple"></p>
</div>
</div>


<script type="module" src="/main.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './src/style.scss';
import './src/index.js';
Loading

0 comments on commit 07acab3

Please sign in to comment.