Skip to content

Commit

Permalink
- more work on styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Srdjan committed Aug 17, 2023
1 parent 8a4753a commit ac943ad
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 40 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ MultiStep component accepts following props (all optional, except Steps array):
| PROPERTY | DESCRIPTION | TYPE | DEFAULT | isRequired|
|----------------|--------------------------------------------------------------|-------------|------------|-----------|
| showTopNav | controls if the navigation buttons are visible |boolean |true |false |
| showTitles | control either the steps title are visible or not |boolean |true |false |
| prevButton | configure the prev navigation button |NavButtonProp |null |false |
| nextButton | configure the next the navigation button |NavButtonProp |null |false |
| stepCustomStyle| control style of step |CSSProperties|null |false |
Expand Down
4 changes: 0 additions & 4 deletions example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ const App = () => (
<StepThree title='Step 3'/>
<StepFour title='Step 4'/>
</MultiStep>
<div className='appFooter'>
Use navigation buttons or click on progress bar for next step. Code is on{' '}
<a href='https://github.com/Srdjan/react-multistep' target='_blank' rel='noreferrer'>GitHub</a>
</div>
</div>
)

Expand Down
21 changes: 10 additions & 11 deletions example/css/multistepStyles.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const container = {
const component = {
marginTop: '5rem',
marginBottom: '5rem',
backgroundColor:'#f1f1f141'
backgroundColor:'#f1f1f141',
maxWidth: '960px',
}
const childArea = {
const section = {
display: 'block',
justifyContent: 'space-around',
margin: '4rem',
maxWidth: '960px'
}
const topNav = {
display: 'flex',
Expand All @@ -22,7 +22,7 @@ const topNavStep = {
width: '25%',
paddingTop: '4rem',
paddingRight: '4rem',
borderBottom: '1px solid silver'
borderBottom: '1px solid silver',
}
const todo = {
color: 'gray',
Expand All @@ -32,26 +32,25 @@ const doing = {
}
const prevButton = {
color: '#1EAEDB',
backgroundColor: 'white',
backgroundColor: '#f7f7f7',
border: '0',
fontSize: '4rem',
fontWeight: '500',
padding: '0',
float: 'left' //only difference
}
const nextButton = {
color: '#1EAEDB',
backgroundColor: 'white',
backgroundColor: '#f7f7f7',
border: '0',
fontSize: '4rem',
fontWeight: '500',
padding: '0',
float: 'right' // only difference
float: 'right', // only difference
}

export const multiStepStyles = {
container,
childArea,
component,
section,
topNav,
topNavStep,
prevButton,
Expand Down
13 changes: 8 additions & 5 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
<link rel="stylesheet" href="./css/normalize.css">

<!-- App styles -->
<link rel="stylesheet" href="./css/milligram.css">
<!-- <link rel="stylesheet" href="./css/milligram.css"> -->
<!-- or -->
<!-- <link rel="stylesheet" href="./css/skeleton.css"> -->
<!-- or -->

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tiny.css@0.12/dist/light.css">
</head>

<body>
<body style='{background-color: #F7F7F7}'>
<!-- <noscript>You need to enable JavaScript to run this app.</noscript> -->
<div id="root"></div>

<article id="root"></article>
<footer class='footer'>
Use navigation buttons or click on progress bar for next step. Code is here:
<a href='https://github.com/Srdjan/react-multistep' target='_blank' rel='noreferrer'>GitHub</a>
</footer>
<script src="./bundle.js"></script>
</body>
</html>
10 changes: 5 additions & 5 deletions src/MultiStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function MultiStep(props: MultiStepProps) {
</ol>

const renderBottomNav = () =>
<>
<div style={styles.section} >
<button onClick={handlePrevious}
style={styles.prevButton}
disabled={bottomNavState.prevDisabled}>
Expand All @@ -78,15 +78,15 @@ export default function MultiStep(props: MultiStepProps) {
disabled={bottomNavState.nextDisabled}>
<span>&#62;</span>
</button>
</>
</div>

return (
<div style={styles.multiStep}>
<div style={styles.component}>
{renderTopNav()}
<div style={styles.childArea}>
<div style={styles.section}>
{children[activeChild]}
</div>
{renderBottomNav()}
{renderBottomNav()}
</div>
)
}
19 changes: 9 additions & 10 deletions src/baseStyles.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const multiStep = {
const component = {
marginRight: '4rem',
marginBottom: '3rem',
maxWidth: '960px'
backgroundColor:'#f7f7f7',
maxWidth: '960px',
}
const childArea = {
const section = {
display: 'block',
justifyContent: 'space-around',
margin: '4rem',
maxWidth: '960px'
}
const topNav = {
paddingTop: '4rem',
listStyleType: 'none',
borderBottom: '1px solid silver'
borderBottom: '1px solid silver',
}
const topNavStep = {
color: 'silver',
Expand All @@ -22,7 +22,7 @@ const todo = {
color: 'gray'
}
const doing = {
color: '#1EAEDB'
color: '#1EAEDB',
}

const prevButton = {
Expand All @@ -32,7 +32,6 @@ const prevButton = {
fontSize: '3rem',
marginLeft: '2rem',
paddingTop: '4rem',
float: 'left' //only difference
}
const nextButton = {
color: '#1EAEDB',
Expand All @@ -41,12 +40,12 @@ const nextButton = {
fontSize: '3rem',
marginRight: '2rem',
paddingTop: '4rem',
float: 'right' // only difference
float: 'right', // only difference
}

export const BaseStyles = {
multiStep,
childArea,
component,
section,
topNav,
topNavStep,
prevButton,
Expand Down
7 changes: 3 additions & 4 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react"

export interface MultiStepStyles {
multiStep?: React.CSSProperties,
childArea?: React.CSSProperties,
component?: React.CSSProperties
section?: React.CSSProperties
topNav?: React.CSSProperties
topNavStep?: React.CSSProperties
todo?: React.CSSProperties
Expand All @@ -12,9 +12,8 @@ export interface MultiStepStyles {
}

export interface MultiStepProps {
showTitles?: boolean, //todo: remove, use topNav.display: none ?
styles: MultiStepStyles
children?: React.ReactElement[]
children: React.ReactElement[]
}

export interface ChildState {
Expand Down

0 comments on commit ac943ad

Please sign in to comment.