Skip to content

Commit

Permalink
Nicer styling for demo page
Browse files Browse the repository at this point in the history
  • Loading branch information
grubersjoe committed Jul 12, 2023
1 parent 13f19dd commit cf071d8
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"ignorePatterns": ["*.css", "*.lock", "node_modules/", "build/", "public/"],
"ignorePatterns": ["*.scss", "*.lock", "node_modules/", "build/", "public/"],
"rules": {
"arrow-body-style": "error",
"react/no-unescaped-entities": 0,
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ A React component to display a GitHub contributions graph based on

## Installation

```
```shell
yarn add react-github-calendar
```

## Development

Start watch mode for library first:

```
```shell
yarn
yarn dev
```

Then start watch mode of example page:

```
```shell
cd example
yarn
yarn dev
Expand All @@ -36,7 +36,7 @@ Open http://localhost:3000.

## Publish a new release

```
```shell
npm publish --dry-run

# When you're happy
Expand All @@ -45,6 +45,6 @@ npm publish --access=public

### Update demo page

```
```shell
yarn deploy
```
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@types/react-dom": "link:../node_modules/@types/react-dom",
"@types/react-syntax-highlighter": "^15.5.6",
"@vitejs/plugin-react": "^4.0.1",
"sass": "^1.63.6",
"typescript": "^5.1.6",
"vite": "^4.3.9"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const CodeBlock: FunctionComponent<Props> = ({ children }) => (
customStyle={{
margin: '0 0 1.5rem',
padding: '1em',
borderRadius: 4,
backgroundColor: '#141414',
border: 'none',
borderRadius: 4,
lineHeight: 1.3,
}}
codeTagProps={{ className: 'syntax-highlighter' }}
Expand Down
38 changes: 21 additions & 17 deletions example/src/Demo.tsx → example/src/components/Demo.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createRef, FormEventHandler, FunctionComponent, useState } from 'react';
import GitHubCalendar, { Props } from 'react-github-calendar';

import './Demo.css';
import pkg from '../package.json';
import '../styles.scss';
import pkg from '../../package.json';

import CodeBlock from './CodeBlock';
import ForkMe from './ForkMe';
import CodeBlock from './CodeBlock.tsx';
import ForkMe from './ForkMe.tsx';
import GitHubButton from 'react-github-btn';

const selectLastHalfYear: Props['transformData'] = contributions => {
Expand Down Expand Up @@ -66,15 +66,17 @@ const Demo: FunctionComponent = () => {
on GitHub
</h4>

<GitHubCalendar username={username} fontSize={16} />
<div style={{ overflowX: 'auto' }}>
<GitHubCalendar username={username} fontSize={16} />
</div>

<p style={{ marginBottom: 12 }}>
<p style={{ marginBottom: '1.25rem' }}>
Made with love by <a href="https://jogruber.de">@grubersjoe</a>, current version:{' '}
<a href="https://www.npmjs.com/package/react-github-calendar">
<code>v{pkg.version}</code>
</a>
</p>
<p>
<div>
<GitHubButton
href="https://github.com/grubersjoe/react-github-calendar"
data-color-scheme="no-preference: light; light: light; dark: dark;"
Expand All @@ -85,7 +87,7 @@ const Demo: FunctionComponent = () => {
>
Star
</GitHubButton>
</p>
</div>
</section>

<section>
Expand Down Expand Up @@ -401,15 +403,17 @@ function transformData(data: Array<Activity>): Array<Activity>;`}

<br />

<GitHubCalendar
username={username}
transformData={selectLastHalfYear}
hideColorLegend
fontSize={16}
labels={{
totalCount: '{{count}} contributions in the last half year',
}}
/>
<div style={{ overflowX: 'auto' }}>
<GitHubCalendar
username={username}
transformData={selectLastHalfYear}
hideColorLegend
fontSize={16}
labels={{
totalCount: '{{count}} contributions in the last half year',
}}
/>
</div>

<p>
The total count will be recalculated based on the transformed data. However, you can
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion example/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { createRoot } from 'react-dom/client';

import Demo from './Demo';
import Demo from './components/Demo.tsx';

const container = document.getElementById('root');

Expand Down
Loading

0 comments on commit cf071d8

Please sign in to comment.