Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added csstype for better typing experience #172

Merged
merged 3 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"cookieconsent": "3.1.1",
"cookies": "0.8.0",
"css-to-react-native": "3.0.0",
"csstype": "^3.0.3",
Vadorequest marked this conversation as resolved.
Show resolved Hide resolved
"deepmerge": "4.2.2",
"emotion-theming": "10.0.27",
"graphql": "15.3.0",
Expand Down
20 changes: 10 additions & 10 deletions src/components/assets/GraphCMSAsset.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
Vadorequest marked this conversation as resolved.
Show resolved Hide resolved
const renderer = TestRenderer
.create(<GraphCMSAsset
id={id}
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const renderer = TestRenderer
.create(<GraphCMSAsset
id={id}
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const renderer = TestRenderer
.create(<GraphCMSAsset
id={id}
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const renderer = TestRenderer
.create(<GraphCMSAsset
id={id}
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const renderer = TestRenderer
.create(<GraphCMSAsset
id={id}
Expand Down Expand Up @@ -190,7 +190,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const renderer = TestRenderer
.create(<GraphCMSAsset
id={id}
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const renderer = TestRenderer
.create(<GraphCMSAsset
id={id}
Expand Down Expand Up @@ -284,7 +284,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const linkId = 'link-test';
const linkUrl = 'https://google.com';

Expand Down Expand Up @@ -328,7 +328,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const linkId = 'link-test';
const linkUrl = 'https://google.com';
const overriddenLinkUrl = 'https://overridden.com';
Expand Down Expand Up @@ -374,7 +374,7 @@ describe('GraphCMSAsset', () => {
const id = 'test';
const title = 'Test asset';
const classes = 'test-class1 test-class2';
const style = { paddingTop: 5 };
const style = { paddingTop: '5' };
const linkId = 'link-test';
const linkUrl = 'https://google.com';
const overriddenLinkUrl = 'https://overridden.com';
Expand Down
32 changes: 16 additions & 16 deletions src/components/assets/__snapshots__/GraphCMSAsset.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports[`GraphCMSAsset should properly render an asset from GraphCMS when the as
src="https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand All @@ -34,7 +34,7 @@ exports[`GraphCMSAsset should properly render an asset from GraphCMS when the as
src="https://media.graphcms.com/quality=value:100/resize=height:300/auto_image/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand All @@ -49,7 +49,7 @@ exports[`GraphCMSAsset should properly render an asset from GraphCMS when the as
src="https://media.graphcms.com/quality=value:100/resize=width:500/auto_image/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand All @@ -64,7 +64,7 @@ exports[`GraphCMSAsset should properly render an asset from GraphCMS when the as
src="https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand All @@ -79,7 +79,7 @@ exports[`GraphCMSAsset should properly render an asset from GraphCMS when the as
src="https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand All @@ -94,7 +94,7 @@ exports[`GraphCMSAsset should properly render an asset from GraphCMS when the as
src="https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand All @@ -109,7 +109,7 @@ exports[`GraphCMSAsset should properly render an asset from GraphCMS when the as
src="https://media.graphcms.com/quality=value:100/resize=width:500,height:300/auto_image/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand Down Expand Up @@ -154,7 +154,7 @@ Object {
"id": "test",
"src": "https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V",
"style": Object {
"paddingTop": 5,
"paddingTop": "5",
},
"title": "Test asset",
}
Expand All @@ -168,7 +168,7 @@ exports[`GraphCMSAsset when the asset is used as a link(<a>) containing an image
onClick={null}
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
target="_blank"
Expand All @@ -180,7 +180,7 @@ exports[`GraphCMSAsset when the asset is used as a link(<a>) containing an image
src="https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand All @@ -195,7 +195,7 @@ Object {
"id": "test",
"src": "https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V",
"style": Object {
"paddingTop": 5,
"paddingTop": "5",
},
"title": "Test asset",
}
Expand All @@ -209,7 +209,7 @@ exports[`GraphCMSAsset when the asset is used as a link(<a>) containing an image
onClick={null}
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
target="_blank"
Expand All @@ -221,7 +221,7 @@ exports[`GraphCMSAsset when the asset is used as a link(<a>) containing an image
src="https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand All @@ -236,7 +236,7 @@ Object {
"id": "test",
"src": "https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V",
"style": Object {
"paddingTop": 5,
"paddingTop": "5",
},
"title": "Test asset",
}
Expand All @@ -250,7 +250,7 @@ exports[`GraphCMSAsset when the asset is used as a link(<a>) containing an image
onClick={[Function]}
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
target="_blank"
Expand All @@ -262,7 +262,7 @@ exports[`GraphCMSAsset when the asset is used as a link(<a>) containing an image
src="https://media.graphcms.com/88YmsSFsSEGI9i0qcH0V"
style={
Object {
"paddingTop": 5,
"paddingTop": "5",
}
}
title="Test asset"
Expand Down
4 changes: 2 additions & 2 deletions src/types/CSSStyles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GenericObject } from './GenericObject';
import * as CSS from 'csstype';

/**
* Represents a CSS "styles" object.
*/
export type CSSStyles = GenericObject<string | number>;
export type CSSStyles = CSS.Properties;
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4948,6 +4948,11 @@ csstype@^3.0.2:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.3.tgz#2b410bbeba38ba9633353aff34b05d9755d065f8"
integrity sha512-jPl+wbWPOWJ7SXsWyqGRk3lGecbar0Cb0OvZF/r/ZU011R4YqiRehgkQ9p4eQfo9DSDLqLL3wHwfxeJiuIsNag==

csstype@^3.0.3:
version "3.0.3"
resolved "https://registry.npmjs.org/csstype/-/csstype-3.0.3.tgz#2b410bbeba38ba9633353aff34b05d9755d065f8"
integrity sha512-jPl+wbWPOWJ7SXsWyqGRk3lGecbar0Cb0OvZF/r/ZU011R4YqiRehgkQ9p4eQfo9DSDLqLL3wHwfxeJiuIsNag==

cyclist@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
Expand Down