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

feat: add react components #40

Closed
wants to merge 0 commits into from
Closed

Conversation

NoeTerrier
Copy link
Contributor

@NoeTerrier NoeTerrier commented Aug 8, 2023

close #32

Create first simple nextjs component of the app

@NoeTerrier NoeTerrier added the feature New feature or request label Aug 8, 2023
@NoeTerrier NoeTerrier self-assigned this Aug 8, 2023
@NoeTerrier NoeTerrier linked an issue Aug 8, 2023 that may be closed by this pull request
9 tasks
Comment on lines 4 to 8
<div className="bg-blue-950 w-10 h-0.5 mr-2" />
<h1 className="uppercase font-mono font-bold text-blue-950">
{text ? text : "Default title"}
</h1>
<div className="bg-blue-950 w-10 h-0.5 ml-2" />
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should have the possibility to change the color and text size from the props

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tailwinds doesn't allow to build dynamic class names (https://tailwindcss.com/docs/content-configuration#dynamic-class-names) but maybe we can use a set of defined colors (like dark or bright theme for example) instead and switching between them according to the value of the props

Copy link
Contributor

Choose a reason for hiding this comment

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

Good to know, thank you 👍 however I think the way you wrote it now makes more sense IMO, which allows the consumer to override the className itself, though it is not type-checked. Maybe there is an enum we can use from Tailwind?

app/src/components/Title.tsx Outdated Show resolved Hide resolved
app/src/components/Title.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use kebab-case file naming convention to be consistent with NextJS

Copy link
Contributor

@codeofmochi codeofmochi Aug 10, 2023

Choose a reason for hiding this comment

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

Actually I think that the best practice for React components specifically is the filename being PascalCase, which should match the component name. Though I agree, conventions in the JS world are a mess 🤮 Let's discuss this next time we meet and write our conventions somewhere (even better if we setup eslint rules or similar)

See https://stackoverflow.com/questions/53132068/naming-best-practices-for-react-components-and-functions-including-filenames

"lockfileVersion": 3,
"lockfileVersion": 1,
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems your npm is not up-to-date. Are you using the devcontainer or your local Node environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope 👀 sorry haha, will do

app/src/components/title.tsx Outdated Show resolved Hide resolved
app/src/components/title.tsx Outdated Show resolved Hide resolved

return (
<div className="flex items-center">
<div className={linesClassNames} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Info: what does this div do? I see that they are both before and after the h1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only for visual, as in the figma component for titles.
image

app/src/pages/index.tsx Outdated Show resolved Hide resolved
Comment on lines 3 to 4
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@trivago/prettier-plugin-sort-imports": "^4.1.0",
"husky": "^8.0.0",
"prettier": "2.8.4"
}
},
"node_modules/@babel/code-frame": {
"version": "7.18.6",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz",
"integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==",
"dev": true,
"dependencies": {
"@babel/highlight": "^7.18.6"
},
"engines": {
"node": ">=6.9.0"
"lockfileVersion": 1,
"dependencies": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment regarding the npm version. With a set of changes that does not change the dependencies (i.e. package.json), the package-lock normally shouldn't change. Let's investigate together next time we meet 👍

@codeofmochi
Copy link
Contributor

codeofmochi commented Aug 10, 2023

By the way @NoeTerrier @Thechi2000 @SidonieBouthors have a look at:

I was reluctant about setting up this additional tool since it's a bit of overhead for newcomers, but I think the work is actually minimal and we will be able to visualize the changes much faster. I already assigned myself since I'm familiar with it, but we can discuss this next time we meet.

@Thechi2000 Thechi2000 removed a link to an issue Aug 15, 2023
9 tasks
Copy link
Contributor

@codeofmochi codeofmochi left a comment

Choose a reason for hiding this comment

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

Just blocking the PR until I add Storybook from #41

@codeofmochi codeofmochi changed the title feat: add Title component feat: add react components Aug 25, 2023
@codeofmochi codeofmochi marked this pull request as draft August 25, 2023 13:38
@Thechi2000
Copy link
Contributor

The commits I pushed are using the Strapi schema from #42

@NoeTerrier NoeTerrier closed this Mar 31, 2024
@NoeTerrier NoeTerrier deleted the 32-add-react-components branch March 31, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add react components
3 participants