-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(@lapidist/image): init * feat(@lapidist/image): initial implementation
- Loading branch information
1 parent
02faccb
commit 19f4cae
Showing
8 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.ts | ||
!*.d.ts | ||
*.spec.js | ||
*.spec.d.ts | ||
*.tsx | ||
*.mdx | ||
tsconfig.json | ||
__snapshots__ | ||
jest.config.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('../../jest.config'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "@lapidist/image", | ||
"version": "0.0.0", | ||
"description": "Image component", | ||
"author": "Brett Dorrans <[email protected]>", | ||
"license": "MIT", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"build": "tsc -p tsconfig.json", | ||
"test": "jest" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"release": { | ||
"analyzeCommits": { | ||
"preset": "angular", | ||
"releaseRules": [ | ||
{ | ||
"type": "build", | ||
"release": "minor" | ||
} | ||
] | ||
} | ||
}, | ||
"dependencies": { | ||
"@lapidist/theme-provider": "^1.15.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import 'jest-styled-components'; | ||
|
||
import Image from './index'; | ||
|
||
test('it works', () => { | ||
const tree = renderer | ||
.create(<Image src="https://placehold.it/500x500" alt="image" />) | ||
.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`it works 1`] = ` | ||
.c0 { | ||
padding-bottom: 16px; | ||
display: block; | ||
width: 100%; | ||
} | ||
<img | ||
alt="image" | ||
className="c0" | ||
src="https://placehold.it/500x500" | ||
/> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { defaultTheme } from '@lapidist/theme-provider'; | ||
|
||
export interface ImageProps { | ||
/** The Image's id. */ | ||
readonly id?: string; | ||
/** The Image's classname. */ | ||
readonly className?: string; | ||
/** The Image's alt tag. */ | ||
readonly alt?: string; | ||
/** The Image's src. */ | ||
readonly src: string; | ||
} | ||
|
||
const ImageContainer: React.FC<ImageProps> = ({ id, className, src, alt }) => ( | ||
<img id={id} className={className} src={src} alt={alt} /> | ||
); | ||
|
||
const Image: React.FC<ImageProps> = styled(ImageContainer)<ImageProps>` | ||
padding-bottom: ${defaultTheme.sizing.m}; | ||
display: block; | ||
width: 100%; | ||
`; | ||
|
||
export default Image; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/tsconfig", | ||
"extends": "../../tsconfig.base.json", | ||
"include": ["src/**/*.ts", "src/**/*.tsx"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters