├── .DS_Store
├── .vscode
└── settings.json
├── LICENSE
├── README.md
├── examples
├── .DS_Store
└── index.html
├── screenshot.png
└── src
├── default.css
└── script.js
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prakhar897/hn-comments-drawer/8963dfc8f15157792e1dee0f635ba4be025f29fb/.DS_Store
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "editor.tabSize": 4,
3 | "editor.detectIndentation": true,
4 | "editor.wordWrap": "on",
5 | "editor.formatOnSave": true,
6 | "editor.defaultFormatter": "esbenp.prettier-vscode",
7 | "editor.codeActionsOnSave": {
8 | "source.fixAll": true
9 | },
10 | "html.format.enable": true,
11 | "html.format.indentInnerHtml": true,
12 | "html.format.indentHandlebars": true,
13 | "html.format.extraLiners": "head, body, /html",
14 | "html.format.unformatted": "code, pre, tt",
15 | "html.format.wrapAttributes": "force-aligned",
16 | "emmet.includeLanguages": {
17 | "html": "html",
18 | "javascript": "javascriptreact"
19 | },
20 | "emmet.triggerExpansionOnTab": true,
21 | "files.exclude": {
22 | "**/.git": true,
23 | "**/.DS_Store": true,
24 | "**/*.js.map": true
25 | },
26 | "[javascript]": {
27 | "editor.tabSize": 4,
28 | "editor.insertSpaces": true
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Prakhar Gupta
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Hacker News Comments Drawer (hn-comments-drawer)
2 |
3 | Integrate Hacker News comments and display them beautifully within your websites.
4 |
5 | [See Discussion on this](https://news.ycombinator.com/item?id=38597301)
6 |
7 | ## Demo
8 |
9 | [Live Demo 1](https://softwaredesign.ing/misc/hn-comments-drawer-demo)
10 |
11 | [Live Demo 2](https://softwaredesign.ing/blog/moving-away-from-substack)
12 |
13 | 
14 |
15 | ## Features
16 |
17 | - Display HN comments using a single line of code.
18 | - Customizable styling for comments.
19 | - Options to vary stuff.
20 |
21 | ## Usage
22 |
23 | 1. Include this snippet in your HTML document:
24 |
25 | ``
26 |
27 | 2. Create an HTML element where you want to display the comments. Use the following format for the ID:
28 |
29 |
32 |
33 |
34 | Replace `38300167` with the actual ID of the Hacker News story for which you want to display comments.
35 |
36 | ## Docs
37 |
38 | - Add maxDepth of comments:
39 |
40 |
44 |
45 |
46 | - Add default styling:
47 |
48 |
49 |
50 | ## Styling
51 |
52 | Customize the styling of the comments by modifying the provided CSS classes in your own stylesheet:
53 |
54 | /* Example of provided CSS classes for comments */
55 |
56 | .hn-comments-drawer {
57 | list-style-type: none;
58 | margin-left: 0;
59 | padding-left: 20px;
60 | border: 2px solid red;
61 | margin-top: 50px;
62 | margin-bottom: 50px;
63 |
64 | }
65 |
66 | .hn-comments-drawer-heading{
67 | border: 2px solid red;
68 | }
69 |
70 | .comments-list {
71 | list-style-type: none; /* Remove default list-style dots */
72 | padding-left: 0; /* Remove default padding */
73 | }
74 |
75 | .comments-list li {
76 | border-left: 2px solid #ccc; /* Adjust thickness and color as needed */
77 | padding-left: 10px; /* Adjust left padding for spacing */
78 | margin-left: 5px; /* Adjust margin for spacing */
79 | margin-top: 20px;
80 | }
81 |
82 | .comment-text {
83 | color: red;
84 | }
85 |
86 | .comment-header {
87 | color:blue;
88 | }
89 |
90 | .comments-loading {
91 | text-align: center;
92 | padding: 2rem;
93 | }
94 |
95 | ## Examples
96 |
97 | You can find examples in the `examples` folder.
98 |
99 | ## Contributing
100 |
101 | Contributions are welcome! Feel free to open issues or submit pull requests for enhancements or bug fixes.
102 |
103 | ## License
104 |
105 | This project is licensed under the MIT License - see the [LICENSE](https://github.com/prakhar897/hn-comments-drawer/LICENSE) file for details.
106 |
--------------------------------------------------------------------------------
/examples/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/prakhar897/hn-comments-drawer/8963dfc8f15157792e1dee0f635ba4be025f29fb/examples/.DS_Store
--------------------------------------------------------------------------------
/examples/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Hacker News Comments
6 |
7 |
8 |
9 |