39
loading...
This website collects cookies to deliver better user experience
content
tab on the left side. This gives you an admin panel where you can perform full CRUD actions for your models -- create a few rental properties! Click Create rental then use the form to create new entries.components
Figma page.CardA
to round the corners, bold some text, and remove the background color.CardA
component and then click Configure.src
prop to rental.image
.rental.name
. Finally, for the price, I'll set what currently says $99 to the price from my data model. I'll also concatenate that with a "$" and "/night".RentalCollection
. Once on the collection page, you can choose whether your cards render in a grid or list, the number of columns, padding between, and the direction of the collection.$ npx create-react-app amplify-studio-tutorial
$ cd amplify-studio-tutorial
$ npm i aws-amplify @aws-amplify/ui-react
amplify pull
command specific to your app by clicking "local setup instructions" in Studio./src/ui-components
-- this contains all of your React components! You can open them up and see what's inside.index.js
file, configure amplify by pasting in these three lines of code:import config from './aws-exports'
import Amplify from 'aws-amplify'
Amplify.configure(config)
return ()
.AmplifyProvider
component, and the Amplify CSS file:import { AmplifyProvider } from '@aws-amplify/ui-react'
import '@aws-amplify/ui-react/styles.css'
AmplifyProvider
at the top level of your return
. This will provide styling to all of its child components.function App () {
return (
<AmplifyProvider>
</AmplifyProvider>
)
}
export default App
RentalCollection
! First, import it:import { RentalCollection } from './ui-components'
function App () {
return (
<AmplifyProvider>
+ <RentalCollection />
</AmplifyProvider>
)
}
export default App
Inter
to your App.css
file:@import url('https://fonts.googleapis.com/css2?family=Inter:slnt,[email protected],100..900&display=swap');
type="list"
to your RentalCollection
.<RentalCollection type="list" />
RentalCollection
component. Inside each of its child components, you'll notice a line of code like this: {...getOverrideProps(overrides, "Collection.CardA[0]")}
. The second value is a key you can use to specify which component you want to add an override to.RentalCollection
instance:<RentalCollection
type='list' overrides={{
'Collection.CardA[0]': {
}
}}
/>
Image
component inside of CardA
. Open up the code for that component, and you'll see similar overrides for each of its child components.cover
.<RentalCollection
type='list' overrides={{
'Collection.CardA[0]': {
overrides: {
'Flex.Image[0]': { objectFit: 'cover' }
}
}
}}
/>
amplify pull
your components will regenerate. Because of this, you won't want to modify the components in the ui-components
directory directly. If you decided you wanted to modify the code in a component file, you could drag it out of that directory and it would no longer get overwritten by amplify pull
!amplify pull
, you'll have a theme object that you can pass as a prop to AmplifyProvider
which will apply your theme to your app!