import SwiftUI

struct OnDeviceFileExplorerFileBar: View {
    let systemIcon: String
    let displayName: String
    let isDirectory: Bool
    let action: () -> Void

    var body: some View {
        Button {
            action()
        } label: {
            HStack {
                ZStack {
                    Image(systemName: systemIcon)
                        .font(.system(size: 12.0, weight: .bold))
                        .foregroundStyle(.blue)
                }
                .frame(width: 48.0)

                Text(displayName)
                    .font(.system(size: 12.0, weight: .bold))
                    .foregroundStyle(.white)
                Spacer()
                Image(systemName: isDirectory ? "chevron.right" : "info.circle")
                    .font(.system(size: 12.0, weight: .bold))
                    .foregroundStyle(.white.opacity(0.5))
                    .padding(.trailing, 8.0)
            }
            .padding(.all, 4.0)
            .frame(minHeight: 48.0)
            .background {
                if isDirectory {
                    Color.blue.opacity(0.1)
                } else {
                    Color.black.opacity(0.1)
                }
            }
            .clipShape(.rect(cornerRadius: 6.0))
        }
        .buttonStyle(.plain)
    }
}
