Skip to content

Commit 5fafa4b

Browse files
Merge pull request #10 from saurabhdaware/feat/dark-theme
Feat/data-theme
2 parents f59aa72 + d8f639e commit 5fafa4b

9 files changed

+328
-28
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
***Changelogs are mentioned in the [Releases](https://github.com/saurabhdaware/DEV-widget/releases) Section***

CONTRIBUTING.md

+33-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
If you are contributing to the Open Source for the first time, You can checkout [First Time Contributors Guide](#first-time-contributors-guide)
1+
If you are contributing to the Open Source for the first time, You can check out [First Time Contributors Guide](#first-time-contributors-guide)
22

33
# Local Setup
44
- [Fork](https://github.com/saurabhdaware/DEV-widget/fork) the repository
@@ -18,7 +18,7 @@ The code is based upon web components and does not use any dependency. You can r
1818
```
1919

2020
# Sending Pull Request
21-
- Create a branch in your forked repository with relevant name (`e.g enhanced-styling`, `feature-autoreload`)
21+
- Create a branch in your forked repository with a relevant name (`e.g enhanced-styling`, `feature-autoreload`)
2222
- Push your changes to the branch
2323
- Create a pull request from your branch to `master` of my branch.
2424

@@ -31,4 +31,34 @@ The code is based upon web components and does not use any dependency. You can r
3131
- You can checkout the [Issues](https://github.com/saurabhdaware/DEV-widget/issues) and select the one that you like (You can comment on issue with something like *"Let me work on this or I'll kill you"* to let me know that you are working on it.)
3232
- There are issues with label `Difficulty: Easy` and `Difficulty: Super Easy` which are easier to solve as compare to the other issues. Though if you know JavaScript well you can solve `Difficulty: Medium` and `Difficulty: Hard` issues as well.
3333
- Just go through the [Local Setup Guide](#local-setup) to locally setup the project
34-
- Once you are done making changes you can create a Pull Request to the master of this (https://github.com/saurabhdaware/DEV-widget) repository.
34+
- Once you are done making changes you can create a Pull Request to the master of this (https://github.com/saurabhdaware/DEV-widget) repository.
35+
36+
37+
# Other Guides
38+
39+
## - Creating Themes
40+
41+
Before you work on a code please create an issue and mention the colors that you want to add and wait for the response. Since adding themes increase the size of the code, only few themes will be chosen for the final version.
42+
43+
Here's an example from `card.style.mjs`:
44+
```css
45+
.card.pink{
46+
--header-bg:#ffc0cb;
47+
--header-color:#222;
48+
--header-logo-filter: invert(0%);
49+
--content-bg: #fff;
50+
--content-bghover: #ffc0cb44;
51+
--content-border: #ffc0cb66;
52+
--content-color: #555;
53+
--button-bg: #222;
54+
--button-color: #ddd;
55+
--scroll-track: #ffc0cb;
56+
--scroll-thumb: #999;
57+
--likes-color: #999;
58+
--likes-icon-filter: invert(0%);
59+
}
60+
```
61+
62+
To create a theme named "yellow", You will have to create a css block for `.card.yellow` and set the variable names as given in the above example.
63+
64+
With these settings adding `data-theme="yellow"` in the file will apply your colors to the card.

README.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You can use it in your website/blog and show off your DEV.to articles :sunflower
2323
<dev-widget data-username="saurabhdaware"></dev-widget>
2424

2525
<!-- Place script tag before the end of the body tag -->
26-
<script src="https://unpkg.com/dev-widget@1.0.3/dist/card.component.mjs" type="module"></script>
26+
<script src="https://unpkg.com/dev-widget@1.1.0/dist/card.component.min.mjs" type="module"></script>
2727
```
2828

2929

@@ -47,21 +47,32 @@ import 'dev-widget'
4747
|---------------|-------------------------------|--------------------------|
4848
| data-username | Your DEV.to Username | |
4949
| data-width | Width of the card | 300px |
50+
| data-theme | **Theme of the card** (dark, ocean, pink, default) | default |
5051
| data-name (optional) | Name to display on card | Will be fetched from API |
5152
| data-limit | Number of articles to display | 30 |
5253

5354
**Note:** Value of `data-limit` should not be too high. An API request has to be made for every 30 articles so for `data-limit=200` 7 API requests will be made synchronously.
5455

5556
So a full example would look something like
5657
```html
57-
<dev-widget data-username="saurabhdaware" data-width="320px" data-limit="3" data-name="Saurabh 😎"></dev-widget>
58+
<dev-widget data-username="saurabhdaware" data-width="320px" data-theme="ocean" data-limit="3" data-name="Saurabh 😎" ></dev-widget>
5859

5960
<!-- Place script tag before the end of the body tag -->
60-
<script src="https://unpkg.com/dev-widget@1.0.3/dist/card.component.mjs" type="module"></script>
61+
<script src="https://unpkg.com/dev-widget@1.1.0/dist/card.component.min.mjs" type="module"></script>
6162
```
6263

64+
---
65+
## Themes
66+
`default` `ocean` `pink` `dark`
67+
![DEV Widget themes](https://res.cloudinary.com/saurabhdaware/image/upload/v1574802681/saurabhdawaretk/dev-widget-2.png)
68+
69+
---
70+
71+
## Changelog
72+
**[RELEASES](https://github.com/saurabhdaware/DEV-widget/releases)**
73+
6374
---
6475

6576
## Contributing
6677

67-
I would love to have some of your contributions on this project. You can checkout [CONTRIBUTING.md](CONTRIBUTING.md) for Contribution guidelines.
78+
I would love to have some of your contributions to this project. You can checkout [CONTRIBUTING.md](CONTRIBUTING.md) for Contribution guidelines.

build/build.main.js

+11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
const fse = require('fs-extra');
2+
const minify = require('@node-minify/core');
3+
const terser = require('@node-minify/terser');
4+
25
if(fse.existsSync('dist')){
36
fse.removeSync('dist')
47
}
58

69
fse.copySync('src','dist');
10+
11+
minify({
12+
compressor: terser,
13+
input: 'src/card.component.mjs',
14+
output: 'dist/card.component.min.mjs',
15+
callback: function(err, min) {}
16+
});
17+
718
fse.writeFileSync('dist/index.js',"export * from './card.component.mjs';")

package-lock.json

+166-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)