If you have a new button style you would like to add or any fixes you want to contribute, be sure to follow this guideline.
You can also join or start discussions with the community members if you have any ideas or questions!
Please note we have a code of conduct, please follow it in all your interactions with the project.
- Issues that have the label
first-timers-only
is made for beginners who have contributed to less than 5 repositories. This is a way to help people who are new to open source and contributing. - Before contributing to an issue, make sure that no one is assigned or has taken that issue. If no one is and you would like to work on the issue, please comment on the issue to let others know that someone is working on the issue.
- Before creating a pull request, it is important that you make sure your branch and repository are up to date with this one. Some conflicts can be resolved, but many are hard to resolve. Add the upstream branch and always keep your branch up to date.
-
Fork the repository.
-
To make changes to the existing buttons, or add new ones, all changes should be made in
src/sbuttons.less
.- If you're adding a new button type similar to basic, hover, etc..., create a file in
src/components
with the name preceded by_
. For example:_basic.less
. Remember to include the file when you're done insrc/sbuttons.less
. - If you're adding a new button to an existing type (for example: animated), create a file in
src/components/<type_name>
with the name preceded by_
. For example:_arrow.less
. Remember to include the file when you're done insrc/components/<type_name>
.
Please follow the convention in naming button classes:
new-class-btn
where new-class is the button name. For example, for hover button it'shover-btn
.There are Two ways to monitor and implement your changes as a developer.
- Let the scripts do it all for you -
npm run build
It does two tasks simultaneously.
a) watch changes in all .less file ,compile the changed files and reflect the necessary changes in dist/sbuttons.css.
b) watch changes in dist/sbuttons.css and minify it into dist/sbuttons.min.css
So you just need to run "npm run build" and rest would be handled by scripts
- Do everything manually -
Here all the control is in your hands
After making any changes, you need to compile the LESS file into CSS. To do that there you can use the following:
-
Start command:
npm start
This will watch the updates and changes you make for any of the
.less
files insidesrc
, then compile them intodist/sbuttons.css
. -
Compile command:
npm run compile
-
Minify command:
npm run clean-css
Make sure to run
npm install
before any of these commands.To see how the button looks like after making changes, you'll need to run the website (follow the next steps).
- If you're adding a new button type similar to basic, hover, etc..., create a file in
-
To make changes to the website:
The website uses React and TailwindCSS. All website related files are under the
website
directory. The components and pages that are written under React are inwebsite/src
.You should not make any changes to files in
website/build
directly. Make all changes in files underwebsite/src
.To start the dev server:
npm start
-
To add new examples, make changes in
website/src/data
-
To add new button colors, add them to
button-colors.json
indata
-
To add new button types, add them to
buttons.json
indata
. It should follow the following format:{ type, //type of button. Will be used for grouping buttons label, //the title of the button section, which will also be shown in the sidebar menu classes, //the default classes of this section. For example, for basic buttons it's "basic-btn" text, //the text to show on the button. If this is omitted, the default text will be the name of the button shouldHaveRoundedType, //indicates if rounded button type should hidden or not, defaults to true shouldHaveBlockType, //indicates if block button type should hidden or not, defaults to true usesColors, //indicates if the button will be using the default sButton colors for the example, defaults to true usesText, //indicates if the button should have a text inside of it. This is useful for icon buttons for example. //defaults to true variations, //this is for button types that don't use buttonColors or don't have normal and rounded // button styling. children, //If the type has subtypes, add them here in an array. The subtypes should //also follow this same type format }
children
can be of the same format above, except it can't have its own children at the moment.variations
can have the following format:{ label, //the title of the variation section in the button example classes, //the classes the button should have in the variation, can be empty string text, //the text to show on the button. If this is omitted, the default text will be the name of the button html, //if the button needs HTML to be placed inside instead of text }
It should be noted that if the parent type has
shouldHaveRoundedType
,shouldHaveBlockType
,usesColors
orusesText
, it will affect the buttons inchildren
andvariations
. Buttons inchildren
can have those attributes as well.
-
-
To submit new projects using sButtons, all projects should be added in
website/src/data/projects.json
. The project object should be of the following format:
{ name, //name of the project about, //short description of the project url, //URL of the project image //Image of the project. When adding a project, take a screenshot of it or add any //image of it under website/public/images/projects and include the path relative to //public here }
- CSS: The website uses TailwindCSS, so not a lot of changes is required in the CSS. However, any changes should be added in
website/src/index.css
-
When adding a new animated button, you need to place the animation or transition that happens on hover in a mixin. Then, you need to call that mixin in the hover state and in an animated
class nested inside that button, so that when the animated
class is added to the button the animation runs without needing to hover the button. Depending on your button, the animation should either be continuous (run infinitly) or just once.
All buttons need to support dark mode when needed. If your button on dark mode does not look so good (problem with the color, animation, etc...), you need to do the following:
- add a
dark-mode
class to the button. - add support for having a parent with
[data-theme="dark"]
.
If you would like to suggest a new button idea, please create a new discussion with the category "idea".
- Create a new branch:
git branch new-branch
- Checkout new branch:
git checkout new-branch
- Add, commit and push your changes to the new branch
git add . git commit -m "changes" git push origin new-branch
- To make sure your forked repository is up to date with this repository. Add this repository as the upstream repository by doing the following:
git remote add upstream https://github.com/sButtons/sbuttons.git
Then, to fetch from this repository:
git fetch upstream
git merge upstream/master master
- Go to your forked repository and press the “New pull request” button.
- Once the pull request is reviewed and approved, it will be merged.
If a pull request is left unchanged for a week after changes are requested and the issue was assigned to the person that sent the new pull request, they will be unassigned and someone else will be given the chance to work on it.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [INSERT EMAIL ADDRESS]. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.