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

Move Reaction's Utils/Responsive over into @artsy/responsive #1

Merged
merged 1 commit into from Oct 27, 2018

Conversation

damassi
Copy link
Member

@damassi damassi commented Sep 7, 2018

See https://github.com/artsy/reaction/pull/1379/files

NOTE: I copied the project setup for Palette since its working well for us.

@peril-staging
Copy link

peril-staging bot commented Sep 7, 2018

Typos for README.md

Line Typo
6 A renderProps based media qu
Got false positives?

Make changes to the global settings spellcheck.json in /artsy/peril-settings.

Generated by 🚫 dangerJS

import { Playground, PropsTable } from 'docz'
import { Responsive } from '../src'

# Responsive
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future docs

@@ -0,0 +1,5 @@
describe("hi", () => {
it("is this working", () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to write some tests

src/index.tsx Outdated

type MediaQuery = keyof typeof themeProps["mediaQueries"]

const { Consumer, Provider } = createResponsiveComponents<MediaQuery>()
Copy link
Member Author

@damassi damassi Sep 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alloy - Running into the same issue as in Reaction where defining context statically makes it difficult to pass in type data. This works for Artsy's use-case, but as a general lib it would be better if we could infer these keys from props that have been passed in to the provider; e.g.,

<ResponsiveProvider <MediaQuery>
  mediaQuery={...}
>
  ... 
</ResponsiveProvider>

(I think ^ should work but need to run for now)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This index file shouldn’t exist, instead rename Responsive.tsx to index.tsx. The idea is that the host project defines its own typed provider and consumer by using the createResponsiveComponents function. This definition of our typed version could probably move into Palette.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, will do 👍

Copy link
Collaborator

@alloy alloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we go ahead and make this more readily available to all our projects, I’d like us to talk over the ramifications of this approach, because I don’t believe this is the best choice as a default solution.

cc @zephraph

README.md Outdated
return <div>Is xs size</div>
} else if (md) {
return <div>Is md size</div>
} else if (touch) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s no ‘touch’ in your example media queries. Did you mean ‘hover’?

src/index.tsx Outdated

type MediaQuery = keyof typeof themeProps["mediaQueries"]

const { Consumer, Provider } = createResponsiveComponents<MediaQuery>()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This index file shouldn’t exist, instead rename Responsive.tsx to index.tsx. The idea is that the host project defines its own typed provider and consumer by using the createResponsiveComponents function. This definition of our typed version could probably move into Palette.

@zephraph
Copy link
Contributor

zephraph commented Sep 7, 2018

I do like this being it's on package that people can consume without pulling in the rest of our stuff... I'm not sure that having it in its own repo makes sense though. We could make palette a monorepo and have this one of the packages inside it maybe?

@damassi
Copy link
Member Author

damassi commented Sep 7, 2018

This is def worth discussing a bit. So palette is our design system but maybe its also our framework? I’m always thinking about breaking apart Reaction into a monorepo so that things can stay fast and focused long-term, but I kinda think we should keep palette focused and Reaction the monorepo (that is, to be clear, independent of Force so that we can continue to quarentine it and eventually replace it with a slimmer, more modern service).

Regarding Responsive living in its own package — I would like to hear what @alloy has to say about its overall architecture and value, but I personally think it deserves to be a stand alone lib. I would use this in all my apps since it works so darn well 😄. @artsy/responsive -- the definition of a library IMO, worthy of its own namespace and independence.

@damassi
Copy link
Member Author

damassi commented Sep 7, 2018

(Update: Discussed conditional rendering issues with @alloy and going to revisit approach with @zephraph.)

@damassi
Copy link
Member Author

damassi commented Oct 27, 2018

(Moving new reaction implementation over)

@damassi damassi merged commit 1faa43f into master Oct 27, 2018
@damassi damassi deleted the initial-file-addition branch October 27, 2018 20:07
@artsyit
Copy link
Contributor

artsyit commented Oct 27, 2018

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

damassi pushed a commit that referenced this pull request Oct 26, 2020
feat: working deep nesting prevention with initial passing test
@artsyit
Copy link
Contributor

artsyit commented Oct 26, 2020

🚀 PR was released in v1.3.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants