Sean,
Following advice you gave me earlier, I too moved over to the AWS stack you mentioned there. Moving from PHP to a full JS stack was incredibly hard work - as you mentioned, a very steep learning curve (very steep indeed!) but it was worth it in the end.
As I had mentioned to you earlier on PM, I had originally started with Redux but moved to Apollo client following your advice and I am ever so pleased that I did. Redux seemed at the time as such an amazing piece of technology then Apollo comes along and suddenly Redux is obsolete (local state, automatic caching/cache updating, graphQL ease of use).
ReactJS + Apollo + AWS is a Godsend for me. A HELL of a lot to learn⊠many a late night and I was on the verge of actually pulling my hair out many a time but so worth it in the end. The beauty of being able to put together a JS app where both the clientside and server app can use the same code for validation etc just makes life so easy. Example: -
You have a model with a field that has a max length. You can just set a constant somewhere in your app and import it as required for html maxlength input fields, client-side validation, client-side error messages, server-side model validation and server-side error messages. To change all those things, you just need to change that 1 const and you are good to go (providing of course you server-side model and database (if an active record) reflect this.
I ended up creating a stripped-down CSS framework with basic padding, margins, font sizes etc as well as using sanitize.css. I use styled-components exclusively aside from simple css classes for color, background-color, padding, margins, font-weight etc. Einstein said âThe definition of genius is taking the complex and making it simple.â. Well, I donât know that I am Einstein and it took a took a lot of work but I ended up with a very simplified system where I can make rapid changes through highly-reusable DRY coding using simplified CSS and styled-components extended styles etc. As an example, I have a simple Badge component to act as a standard badge/label, which is then inherited by my Button component to add Button-specific styling.
import styled from "styled-components"
const Badge = styled.span`
display: inline-block;
font-weight: ${props => props.theme.font.weight.normal};
padding: ${props => props.theme.components.forms.padding};
text-align: center;
white-space: nowrap;
vertical-align: middle;
border: 1px solid transparent;
`;
export default Badge
import { Badge } from '_components'
import styled from "styled-components"
const Button = styled(Badge.withComponent('button'))`
user-select: none;
cursor: pointer;
outline: 0px;
&.disabled, &:disabled {
opacity: .65;
cursor: not-allowed;
}
transition: all .15s ease-in-out;
`
export default Button
I can then use the Button component anywhere in the app, styling the color and background with the few CSS classes I use (injected via styled-components).
<Button className="bg-blue bg-hover cl-white" type="submit">Submit</Button>
import ThemeStyles from "_css/themes/main/ThemeStyles"
<ThemeProvider theme={MainTheme}>
import colors from "./variables/colors"
import styled from 'styled-components'
const ThemeStyles = styled.div`
// BACKGROUNDS
.bg-blue {
background-color: ${colors.blue};
&.bg-hover{
&:not([disabled]):not(.disabled):hover{
background-color: ${colors.blueHover};
border-color: ${colors.blueHoverBorder};
}
}
}
// COLORS
.cl-white{color: ${colors.white}}
`
export default ThemeStyles
Many of my base components are based on Bootstrap 4 but, as mentioned above, I have a very minimal CSS implementation. I have a similar implementation for Input and TextArea that both inherit from a common FormControl parent, while (obviously) changing the html element type.
I still have a soft spot for PHP as it was my first love haha but I have almost no need to use it now. Actually, I only use PHP in Yii2 migrations for my current project which otherwise is entirely JS. I found JS based migrations (Sequelize) to be a PITA so I just used Yii2 but I will probably eventually move all that over to JS, too.
Sean - thanks again for the advice you previously gave me both on this thread and on PM, it was a game-changer for me. Boy oh boy was that learning curve steep and (at times) INCREDIBLY hard work but very, very worth it in the end!!! Itâs just a joy to be able to develop at this speed, all using a single language (Javascript).