Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@codersrank/activity
Advanced tools
CodersRank Activity Widget is a web component that allows you easily integrate nice looking activity chart from your CodersRank profile to your personal website:
Widget script available through NPM:
npm i @codersrank/activity --save
After installation you need to import and register web component:
import CodersRankActivity from '@codersrank/activity';
// register web component as <codersrank-activity> element
window.customElements.define('codersrank-activity', CodersRankActivity);
Widget can also be downloaded or linked directly from CDN:
<!-- replace x.x.x with actual version -->
<script src="https://unpkg.com/@codersrank/activity@x.x.x/codersrank-activity.min.js"></script>
In this case it is not required to register web component, it is already registered as <codersrank-activity>
element.
As it is a web component the usage is pretty simple, just add widget HTML tag with your CodersRank username
<codersrank-activity username="YOUR_USERNAME"></codersrank-activity>
Widget supports following properties as HTML element attributes:
Name | Type | Default | Description |
---|---|---|---|
username | string | Your CodersRank username | |
weeks | number | 52 | Amount of weeks to be rendered in chart (max 52 ). |
labels | boolean | false | Display chart labels (months and days of the week) |
legend | boolean | false | Display legend below the chart |
tooltip | boolean | false | Enables tooltip with number of activities per day |
step | number | 10 | Number of activities for division by colors |
svg-width | number | 800 | Render width of chart's SVG element |
For example, to enable labels, legend and tooltip:
<codersrank-activity username="YOUR_USERNAME" labels legend tooltip></codersrank-activity>
It is possible to customize widget colors with CSS Custom Properties (CSS Variables) by setting them directly on the widget element with style attribute or in CSS.
There are following CSS Custom Properties are available:
Property | Value |
---|---|
--font-family | Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif |
--label-font-size | 9px |
--label-text-color | #999ea4 |
--legend-font-size | 12px |
--legend-text-color | #999ea4 |
--legend-item-width | 14px |
--legend-item-height | 14px |
--legend-margin | 1em 0 0 0 |
--bg-color-0 | #f6f6f6 |
--bg-color-1 | rgba(80, 176, 186, 0.3) |
--bg-color-2 | rgba(80, 176, 186, 0.6) |
--bg-color-3 | rgba(80, 176, 186, 1) |
--bg-color-4 | #24565a |
--border-color-0 | transparent |
--border-color-1 | transparent |
--border-color-2 | transparent |
--border-color-3 | transparent |
--border-color-4 | transparent |
--svg-width | 100% |
--svg-height | auto |
--preloader-color | #72a0a8 |
--tooltip-font-size | 14px |
For example, to change legend text color to red
and font-size to 10px
, add this to CSS stylesheet:
codersrank-activity {
--legend-text-color: red;
--legend-font-size: 10px;
}
Widget element supports the following events:
Name | Description | Detail |
---|---|---|
error | Will be fired on data request error | event.detail will contain an error object |
data | Will be fired right after data request |
event.detail will contain an object with data and total properties.
|
For example:
<codersrank-activity id="activity" ...></codersrank-activity>
function onData(event) {
const total = event.detail.total;
console.log(`${total} activities in the last year`);
}
document.querySelector('#activity').addEventListener('data', onData);
Yes please! See the contributing guidelines for details.
This project is licensed under the terms of the MIT license.
FAQs
CodersRank activity widget
The npm package @codersrank/activity receives a total of 249 weekly downloads. As such, @codersrank/activity popularity was classified as not popular.
We found that @codersrank/activity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.