You can use the Uniswap TheGraph for this! For example a query to get the last 10 swaps from the DAI/ETH pair would be:
{
swaps(first: 10, where: { pair: "0xa478c2975ab1ea89e8196811f51a7b7ade33eb11" } orderBy: timestamp, orderDirection: desc) {
transaction {
id
timestamp
}
id
pair {
token0 {
id
symbol
}
token1 {
id
symbol
}
}
amount0In
amount0Out
amount1In
amount1Out
amountUSD
to
}
}
You can play around with queries at: https://thegraph.com/explorer/subgraph/uniswap/uniswap-v2. Integration into the frontend would happen with something like Apollo Client.
In fact this is also what the Uniswap Info is doing. It's open-source, so look around for example queries and how to use them.
For more information on how TheGraph and queries work, I just posted a blog-post about it: https://soliditydeveloper.com/thegraph.