add react and typescript
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
||||
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
*/
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.place-items-center {
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.h-screen {
|
||||
height: 100vh;
|
||||
}
|
||||
11
app/assets/stylesheets/application.scss
Normal file
11
app/assets/stylesheets/application.scss
Normal file
@@ -0,0 +1,11 @@
|
||||
.grid {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.place-items-center {
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.h-screen {
|
||||
height: 100vh;
|
||||
}
|
||||
5
app/controllers/home_controller.rb
Normal file
5
app/controllers/home_controller.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
class HomeController < ApplicationController
|
||||
def index
|
||||
end
|
||||
end
|
||||
3
app/helpers/home_helper.rb
Normal file
3
app/helpers/home_helper.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
module HomeHelper
|
||||
end
|
||||
@@ -3,11 +3,13 @@
|
||||
// a relevant structure within app/javascript and only use these pack files to reference
|
||||
// that code so it'll be compiled.
|
||||
|
||||
import Rails from "@rails/ujs"
|
||||
import Turbolinks from "turbolinks"
|
||||
import * as ActiveStorage from "@rails/activestorage"
|
||||
import "channels"
|
||||
// import Rails from "@rails/ujs"
|
||||
// import Turbolinks from "turbolinks"
|
||||
// import * as ActiveStorage from "@rails/activestorage"
|
||||
// import "channels"
|
||||
|
||||
Rails.start()
|
||||
Turbolinks.start()
|
||||
ActiveStorage.start()
|
||||
// Rails.start()
|
||||
// Turbolinks.start()
|
||||
// ActiveStorage.start()
|
||||
|
||||
import './src/index'
|
||||
19
app/javascript/packs/src/App.tsx
Normal file
19
app/javascript/packs/src/App.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from "react"
|
||||
import {
|
||||
BrowserRouter as Router,
|
||||
Switch,
|
||||
Route,
|
||||
} from "react-router-dom";
|
||||
|
||||
export const App = () => (
|
||||
<Router>
|
||||
<Switch>
|
||||
<Route path="/about">
|
||||
<div>About!</div>
|
||||
</Route>
|
||||
<Route path="/">
|
||||
<div>Hello World!</div>
|
||||
</Route>
|
||||
</Switch>
|
||||
</Router>
|
||||
)
|
||||
13
app/javascript/packs/src/index.tsx
Normal file
13
app/javascript/packs/src/index.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import { App } from './App'
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
,
|
||||
document.getElementById('root'),
|
||||
)
|
||||
})
|
||||
1
app/views/home/index.html.erb
Normal file
1
app/views/home/index.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<div id="root"></div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>XStake</title>
|
||||
<title>X Stake</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
|
||||
Reference in New Issue
Block a user